Skip to main content

Notifier

Trait Notifier 

Source
pub trait Notifier: Send + Sync {
    // Required methods
    fn notify<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn wait<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Cross-process wake-up channel. The submitter calls notify after enqueue; the worker awaits wait to short-circuit its poll interval and pick up new work immediately.

Implementations may coalesce notifications: many notify() calls may release a single wait(). The worker still re-polls the store on every wake, so missing a notification is at worst a latency cost, never lost work.

Required Methods§

Source

fn notify<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Signal that new work was added.

Source

fn wait<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Block until a notification arrives. Spurious wake-ups are allowed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§