[−][src]Struct stakker::Deferrer
Defer queue which can be accessed without a Core
ref
Deferrer
provides a way to defer calls from contexts which
don't have access to a Core
reference. The most obvious of
these is a Drop
handler. So when a Drop
handler needs to
queue cleanup actions, keep a Deferrer
instance in the
structure and then those operations can be deferred without
problem. (The size of a Deferrer
instance is 0 bytes for the
global or thread-local implementations, or a usize
for inline.)
Obtain a Deferrer
instance using Core::deferrer
. To use
it, call the Deferrer::defer
method with a closure which
performs the operation required. Note that all Actor
instances have a Deferrer
built in which can be used from
outside the actor as Actor::defer
.
Note that in cleanup, deferring an action after the main loop has
stopped running the Stakker
queues or after the Stakker
instance has been dropped will be accepted but the call will never
execute. So make sure that all actors are terminated before the
last run of the Stakker
queues if you need cleanup actions to
complete.
Implementations
impl Deferrer
[src]
pub fn defer(&self, f: impl FnOnce(&mut Stakker) + 'static)
[src]
Defer a call to be executed in the main loop at the next opportunity.
Trait Implementations
impl Clone for Deferrer
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for Deferrer
impl !Send for Deferrer
impl !Sync for Deferrer
impl Unpin for Deferrer
impl UnwindSafe for Deferrer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
[src]
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CloneAny for T where
T: Clone + Any,
[src]
T: Clone + Any,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,