[][src]Struct stakker::Deferrer

pub struct 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]

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]

impl<T> Any for T where
    T: Any
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CloneAny for T where
    T: Clone + Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.