pub struct DispatcherRef<'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> DispatcherRef<'a>
impl<'a> DispatcherRef<'a>
Sourcepub unsafe fn from_raw(handle: NonNull<fdf_dispatcher>) -> DispatcherRef<'a>
pub unsafe fn from_raw(handle: NonNull<fdf_dispatcher>) -> DispatcherRef<'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>,
) -> DispatcherRef<'a>
pub fn from_async_dispatcher( dispatcher: AsyncDispatcherRef<'a>, ) -> DispatcherRef<'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.
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 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) -> DispatcherRef<'_>
pub fn as_dispatcher_ref(&self) -> DispatcherRef<'_>
Returns a DispatcherRef that references this dispatcher with a lifetime constrained by
self.
Trait Implementations§
Source§impl<'a> AsyncDispatcher for DispatcherRef<'a>
impl<'a> AsyncDispatcher for DispatcherRef<'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 DispatcherRef<'a>
impl<'a> Clone for DispatcherRef<'a>
Source§fn clone(&self) -> DispatcherRef<'a>
fn clone(&self) -> DispatcherRef<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for DispatcherRef<'a>
impl<'a> Debug for DispatcherRef<'a>
Source§impl<'a> Deref for DispatcherRef<'a>
impl<'a> Deref for DispatcherRef<'a>
Source§type Target = Dispatcher
type Target = Dispatcher
Source§impl<'a> DerefMut for DispatcherRef<'a>
impl<'a> DerefMut for DispatcherRef<'a>
Source§impl<'a> OnDispatcher for DispatcherRef<'a>
impl<'a> OnDispatcher for DispatcherRef<'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
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,
) -> Result<JoinHandle<()>, Status>where
Self: 'static,
fn spawn(
&self,
future: impl Future<Output = ()> + Send + '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