Skip to main content

GetAsyncDispatcher

Trait GetAsyncDispatcher 

Source
pub trait GetAsyncDispatcher {
    // Required method
    fn try_get_async_dispatcher(&self) -> Option<AsyncDispatcher>;

    // Provided method
    fn get_async_dispatcher(&self) -> AsyncDispatcher { ... }
}
Expand description

A trait for things that can be represented as an AsyncDispatcher.

This is automatically implemented for things that implement AsAsyncDispatcherRef, but may be implemented by other things that have more logic to how they obtain the correct dispatcher object.

Required Methods§

Source

fn try_get_async_dispatcher(&self) -> Option<AsyncDispatcher>

Returns a refcounted handle to the active dispatcher for this object, if there is one. Some types of dispatchers (like for the current dispatcher of a thread) may not always have an active dispatcher, so it is returned as an option.

Provided Methods§

Source

fn get_async_dispatcher(&self) -> AsyncDispatcher

Returns a refcounted handle to the active dispatcher for this object.

§Panics

Some types of dispatchers (like for the current dispatcher of a thread) may not always have an active dispatcher, in which case this will panic. If you need to be able to handle there not being an active dispatcher, use Self::try_get_async_dispatcher.

Implementors§