Struct AsyncDispatcher
pub struct AsyncDispatcher(/* private fields */);Expand description
A reference to a dispatcher that supports the v4 async api’s reference counting operations, and so can be held safely without a lifetime.
Implementations§
§impl AsyncDispatcher
impl AsyncDispatcher
pub fn new(dispatcher: &impl AsAsyncDispatcherRef) -> AsyncDispatcher
pub fn new(dispatcher: &impl AsAsyncDispatcherRef) -> AsyncDispatcher
Converts from something that implements AsAsyncDispatcherRef to an AsyncDispatcher
if it implements the v4 async api’s reference counting.
§Panics
This will panic if the implementation does not support reference counting. If you need to be
able to deal with a dispatcher that might not implement this api, you can use
AsyncDispatcher::new.
pub fn try_new(
dispatcher: &impl AsAsyncDispatcherRef,
) -> Result<AsyncDispatcher, Status>
pub fn try_new( dispatcher: &impl AsAsyncDispatcherRef, ) -> Result<AsyncDispatcher, Status>
Converts from something that implements AsAsyncDispatcherRef to an AsyncDispatcher
if it implements the v4 async api’s reference counting.
Returns [Status::UNSUPPORTED] if the dispatcher does not support refcounting.
Trait Implementations§
§impl AsAsyncDispatcherRef for AsyncDispatcher
impl AsAsyncDispatcherRef for AsyncDispatcher
§fn as_async_dispatcher_ref(&self) -> AsyncDispatcherRef<'_>
fn as_async_dispatcher_ref(&self) -> AsyncDispatcherRef<'_>
Gets an
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>
Schedules the callback [
p] to be run on this dispatcher later.§impl Clone for AsyncDispatcher
impl Clone for AsyncDispatcher
§fn clone(&self) -> AsyncDispatcher
fn clone(&self) -> AsyncDispatcher
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for AsyncDispatcher
impl Debug for AsyncDispatcher
§impl Drop for AsyncDispatcher
impl Drop for AsyncDispatcher
impl Send for AsyncDispatcher
impl Sync for AsyncDispatcher
Auto Trait Implementations§
impl Freeze for AsyncDispatcher
impl RefUnwindSafe for AsyncDispatcher
impl Unpin for AsyncDispatcher
impl UnsafeUnpin for AsyncDispatcher
impl UnwindSafe for AsyncDispatcher
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
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> ⓘ
Returns a future that will fire when after the given deadline time. Read more
§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
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. 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>,
Helper version of
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,
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. 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,
Spawn an asynchronous local 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. 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