pub struct AsyncDispatcherRef<'a>(/* private fields */);Expand description
An unowned reference to a driver runtime dispatcher such as is produced by calling
[AsyncDispatcher::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> AsyncDispatcherRef<'a>
impl<'a> AsyncDispatcherRef<'a>
Sourcepub unsafe fn from_raw(ptr: NonNull<async_dispatcher>) -> AsyncDispatcherRef<'a>
pub unsafe fn from_raw(ptr: NonNull<async_dispatcher>) -> AsyncDispatcherRef<'a>
Creates a dispatcher ref from a raw ptr.
§Safety
Caller is responsible for ensuring that the given ptr is valid for
the lifetime 'a.
Trait Implementations§
Source§impl<'a> AsyncDispatcher for AsyncDispatcherRef<'a>
impl<'a> AsyncDispatcher for AsyncDispatcherRef<'a>
Source§fn as_async_dispatcher_ref(&self) -> AsyncDispatcherRef<'_>
fn as_async_dispatcher_ref(&self) -> AsyncDispatcherRef<'_>
Gets an
AsyncDispatcherRef corresponding to this object.Source§fn post_task_sync(&self, p: impl TaskCallback) -> Result<(), Status>
fn post_task_sync(&self, p: impl TaskCallback) -> Result<(), Status>
Schedules the callback [
p] to be run on this dispatcher later.Source§fn now(&self) -> Instant<MonotonicTimeline>
fn now(&self) -> Instant<MonotonicTimeline>
Returns the current time on the dispatcher’s timeline
Source§impl<'a> Clone for AsyncDispatcherRef<'a>
impl<'a> Clone for AsyncDispatcherRef<'a>
Source§fn clone(&self) -> AsyncDispatcherRef<'a>
fn clone(&self) -> AsyncDispatcherRef<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for AsyncDispatcherRef<'a>
impl<'a> Debug for AsyncDispatcherRef<'a>
Source§impl<'a> OnDispatcher for AsyncDispatcherRef<'a>
impl<'a> OnDispatcher for AsyncDispatcherRef<'a>
Source§fn on_dispatcher<R>(
&self,
f: impl FnOnce(Option<AsyncDispatcherRef<'_>>) -> R,
) -> R
fn on_dispatcher<R>( &self, f: impl FnOnce(Option<AsyncDispatcherRef<'_>>) -> R, ) -> R
Runs the function
f with a lifetime-bound AsyncDispatcherRef for this object’s dispatcher.
If the dispatcher is no longer valid, the callback will be given None.Source§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>,
Helper version of
OnDispatcher::on_dispatcher that translates an invalidated dispatcher
handle into a [Status::BAD_STATE] error instead of giving the callback None.Source§fn spawn_task(
&self,
future: impl Future<Output = ()> + Send + 'static,
) -> Result<(), Status>where
Self: 'static,
fn spawn_task(
&self,
future: impl Future<Output = ()> + Send + 'static,
) -> Result<(), Status>where
Self: 'static,
Spawn an asynchronous task on this dispatcher. If this returns
Ok then the task
has successfully been scheduled and will run or be cancelled and dropped when the dispatcher
shuts down.Source§fn after_deadline(
&self,
deadline: Instant<MonotonicTimeline>,
) -> AfterDeadline<Self> ⓘ
fn after_deadline( &self, deadline: Instant<MonotonicTimeline>, ) -> AfterDeadline<Self> ⓘ
Returns a future that will fire when after the given deadline time. Read more
impl<'a> Send for AsyncDispatcherRef<'a>
impl<'a> Sync for AsyncDispatcherRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for AsyncDispatcherRef<'a>
impl<'a> RefUnwindSafe for AsyncDispatcherRef<'a>
impl<'a> Unpin for AsyncDispatcherRef<'a>
impl<'a> UnwindSafe for AsyncDispatcherRef<'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
Mutably borrows from an owned value. Read more