pub struct AutoReleaseDispatcher { /* private fields */ }Expand description
An owned reference to a driver runtime dispatcher that auto-releases when dropped. This gives
you the best of both worlds of having an Arc<Dispatcher> and a DispatcherRef<'static>
created by Dispatcher::release:
- You can vend [
Weak]-like pointers to it that will not cause memory access errors if used after the dispatcher has shut down, like an [Arc]. - You can tie its terminal lifetime to that of the driver itself.
This is particularly useful in tests.
Implementations§
Source§impl AutoReleaseDispatcher
impl AutoReleaseDispatcher
Sourcepub unsafe fn from_raw(
dispatcher: NonNull<fdf_dispatcher>,
) -> AutoReleaseDispatcher
pub unsafe fn from_raw( dispatcher: NonNull<fdf_dispatcher>, ) -> AutoReleaseDispatcher
Creates a dispatcher ref from a raw handle.
§Safety
Caller is responsible for ensuring that the given handle is valid and not owned by any other wrapper that will free it at an arbitrary time.
Sourcepub fn as_async_dispatcher(&self) -> AsyncDispatcher
pub fn as_async_dispatcher(&self) -> AsyncDispatcher
Returns a weakened reference to this dispatcher. This weak reference will only be valid so long as the dispatcher is shutting down, after which it will no longer be usable to spawn tasks 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.
Sourcepub fn always_on_dispatcher(&self) -> AutoReleaseDispatcher
pub fn always_on_dispatcher(&self) -> AutoReleaseDispatcher
Returns the Always-On interface of this dispatcher.
Trait Implementations§
Source§impl AsAsyncDispatcherRef for AutoReleaseDispatcher
impl AsAsyncDispatcherRef for AutoReleaseDispatcher
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 Debug for AutoReleaseDispatcher
impl Debug for AutoReleaseDispatcher
Source§impl From<Dispatcher> for AutoReleaseDispatcher
impl From<Dispatcher> for AutoReleaseDispatcher
Source§fn from(dispatcher: Dispatcher) -> AutoReleaseDispatcher
fn from(dispatcher: Dispatcher) -> AutoReleaseDispatcher
Auto Trait Implementations§
impl Freeze for AutoReleaseDispatcher
impl RefUnwindSafe for AutoReleaseDispatcher
impl Send for AutoReleaseDispatcher
impl Sync for AutoReleaseDispatcher
impl Unpin for AutoReleaseDispatcher
impl UnsafeUnpin for AutoReleaseDispatcher
impl UnwindSafe for AutoReleaseDispatcher
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> DispatcherSignalExt for Twhere
T: GetAsyncDispatcher,
impl<T> DispatcherSignalExt for Twhere
T: GetAsyncDispatcher,
Source§fn on_signals<H>(&self, handle: H, signals: Signals) -> OnSignals<H>where
H: AsHandleRef,
fn on_signals<H>(&self, handle: H, signals: Signals) -> OnSignals<H>where
H: AsHandleRef,
Source§fn try_on_signals<H>(&self, handle: H, signals: Signals) -> Option<OnSignals<H>>where
H: AsHandleRef,
fn try_on_signals<H>(&self, handle: H, signals: Signals) -> Option<OnSignals<H>>where
H: AsHandleRef,
None if there is no dispatcher found on self.