Skip to main content

Consumer

Trait Consumer 

Source
pub trait Consumer<T: Send>: Debug + Send {
    // Required methods
    fn recv<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Delivery<T>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn is_empty(&self) -> bool;
}
Expand description

Pulls items from a lane for processing. Exactly one consumer is active per lane at a time; a restarted engine obtains a fresh one over the same lane and is redelivered whatever the previous one left unacknowledged.

Required Methods§

Source

fn recv<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Option<Delivery<T>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The next delivery, or None once the lane is closed and drained.

Source

fn is_empty(&self) -> bool

Whether nothing is waiting behind the last delivery — the sink engine’s caught-up hint, read at a batch boundary and forwarded to the sink’s flush so a destination with a cost to making writes visible can pay it only when idle. A point-in-time snapshot; an adapter that cannot tell returns false.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§