pub struct DriverDispatcherRef<'a>(/* private fields */);Expand description
An unowned reference to a driver runtime dispatcher such as is produced by calling
Dispatcher::release. When this object goes out of scope it won’t shut down the dispatcher,
leaving that up to the driver runtime or another owner.
Implementations§
Source§impl<'a> DriverDispatcherRef<'a>
impl<'a> DriverDispatcherRef<'a>
Sourcepub unsafe fn from_raw(
handle: NonNull<fdf_dispatcher>,
) -> DriverDispatcherRef<'a>
pub unsafe fn from_raw( handle: NonNull<fdf_dispatcher>, ) -> DriverDispatcherRef<'a>
Creates a dispatcher ref from a raw handle.
§Safety
Caller is responsible for ensuring that the given handle is valid for
the lifetime 'a.
Sourcepub fn from_async_dispatcher(
dispatcher: AsyncDispatcherRef<'a>,
) -> DriverDispatcherRef<'a>
pub fn from_async_dispatcher( dispatcher: AsyncDispatcherRef<'a>, ) -> DriverDispatcherRef<'a>
Creates a dispatcher ref from an AsyncDispatcherRef.
§Panics
Note that this will cause an assert if the AsyncDispatcherRef was not created from a
driver dispatcher in the first place.
Sourcepub unsafe fn as_raw(&mut self) -> *mut fdf_dispatcher
pub unsafe fn as_raw(&mut self) -> *mut fdf_dispatcher
Gets the raw handle from this dispatcher ref.
§Safety
Caller is responsible for ensuring that the dispatcher handle is used safely.
Sourcepub fn always_on_dispatcher(&self) -> DriverDispatcherRef<'a>
pub fn always_on_dispatcher(&self) -> DriverDispatcherRef<'a>
Returns a [DispatcherRef] for the always-on dispatcher associated with this dispatcher,
preserving the lifetime parameter of the parent dispatcher.
Methods from Deref<Target = Dispatcher>§
Sourcepub fn is_unsynchronized(&self) -> bool
pub fn is_unsynchronized(&self) -> bool
Whether this dispatcher’s tasks and futures can run on multiple threads at the same time.
Sourcepub fn allows_thread_blocking(&self) -> bool
pub fn allows_thread_blocking(&self) -> bool
Whether this dispatcher is allowed to call blocking functions or not
Sourcepub fn allows_thread_migration(&self) -> bool
pub fn allows_thread_migration(&self) -> bool
Whether this dispatcher is allowed to migrate threads, in which case it can’t
be used for non-Send tasks.
Sourcepub fn is_current_dispatcher(&self) -> bool
pub fn is_current_dispatcher(&self) -> bool
Whether this is the dispatcher the current thread is running on
Sourcepub fn as_dispatcher_ref(&self) -> DriverDispatcherRef<'_>
pub fn as_dispatcher_ref(&self) -> DriverDispatcherRef<'_>
Returns a [DispatcherRef] that references this dispatcher with a lifetime constrained by
self.
Trait Implementations§
Source§impl<'a> AsAsyncDispatcherRef for DriverDispatcherRef<'a>
impl<'a> AsAsyncDispatcherRef for DriverDispatcherRef<'a>
Source§fn as_async_dispatcher_ref(&self) -> AsyncDispatcherRef<'_>
fn as_async_dispatcher_ref(&self) -> AsyncDispatcherRef<'_>
AsyncDispatcherRef corresponding to this object.§fn post_task_sync(&self, p: impl TaskCallback) -> Result<(), Status>
fn post_task_sync(&self, p: impl TaskCallback) -> Result<(), Status>
p] to be run on this dispatcher later.Source§impl<'a> Clone for DriverDispatcherRef<'a>
impl<'a> Clone for DriverDispatcherRef<'a>
Source§fn clone(&self) -> DriverDispatcherRef<'a>
fn clone(&self) -> DriverDispatcherRef<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for DriverDispatcherRef<'a>
impl<'a> Debug for DriverDispatcherRef<'a>
Source§impl<'a> Deref for DriverDispatcherRef<'a>
impl<'a> Deref for DriverDispatcherRef<'a>
Source§type Target = Dispatcher
type Target = Dispatcher
Source§impl<'a> DerefMut for DriverDispatcherRef<'a>
impl<'a> DerefMut for DriverDispatcherRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for DriverDispatcherRef<'a>
impl<'a> RefUnwindSafe for DriverDispatcherRef<'a>
impl<'a> Send for DriverDispatcherRef<'a>
impl<'a> Sync for DriverDispatcherRef<'a>
impl<'a> Unpin for DriverDispatcherRef<'a>
impl<'a> UnsafeUnpin for DriverDispatcherRef<'a>
impl<'a> UnwindSafe for DriverDispatcherRef<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DispatcherTimerExt for Twhere
T: OnDispatcher,
impl<T> DispatcherTimerExt for Twhere
T: OnDispatcher,
§fn after_deadline(
&self,
deadline: Instant<MonotonicTimeline>,
) -> AfterDeadline<T> ⓘ
fn after_deadline( &self, deadline: Instant<MonotonicTimeline>, ) -> AfterDeadline<T> ⓘ
§impl<T> OnDispatcher for Twhere
T: AsAsyncDispatcherRef + Clone,
impl<T> OnDispatcher for Twhere
T: AsAsyncDispatcherRef + Clone,
§fn on_dispatcher<R>(
&self,
f: impl FnOnce(Option<AsyncDispatcherRef<'_>>) -> R,
) -> R
fn on_dispatcher<R>( &self, f: impl FnOnce(Option<AsyncDispatcherRef<'_>>) -> R, ) -> R
f with a lifetime-bound AsyncDispatcherRef for this object’s dispatcher.
If the dispatcher is no longer valid, the callback will be given None. Read more§fn on_maybe_dispatcher<R, E>(
&self,
f: impl FnOnce(AsyncDispatcherRef<'_>) -> Result<R, E>,
) -> Result<R, E>where
E: From<Status>,
fn on_maybe_dispatcher<R, E>(
&self,
f: impl FnOnce(AsyncDispatcherRef<'_>) -> Result<R, E>,
) -> Result<R, E>where
E: From<Status>,
OnDispatcher::on_dispatcher that translates an invalidated dispatcher
handle into a [Status::BAD_STATE] error instead of giving the callback None. Read more§fn spawn(
&self,
future: impl Future<Output = ()> + Send + 'static,
) -> JoinHandle<()> ⓘwhere
Self: 'static,
fn spawn(
&self,
future: impl Future<Output = ()> + Send + 'static,
) -> JoinHandle<()> ⓘwhere
Self: 'static,
Ok then the task has
successfully been scheduled and will run or be cancelled and dropped when the dispatcher
shuts down. The returned future’s result will be Ok if the future completed
successfully, or an Err if the task did not complete for some reason (like the
dispatcher shut down). Read moreSource§impl<T> OnDriverDispatcher for Twhere
T: AsAsyncDispatcherRef + Clone,
impl<T> OnDriverDispatcher for Twhere
T: AsAsyncDispatcherRef + Clone,
Source§fn spawn_local(
&self,
future: impl Future<Output = ()> + 'static,
) -> Result<JoinHandle<()>, Status>where
Self: 'static,
fn spawn_local(
&self,
future: impl Future<Output = ()> + 'static,
) -> Result<JoinHandle<()>, Status>where
Self: 'static,
Ok then the task
has successfully been scheduled and will run or be cancelled and dropped when the dispatcher
shuts down. The returned future’s result will be Ok if the future completed
successfully, or an Err if the task did not complete for some reason (like the
dispatcher shut down). Read more