Skip to main content

MapOne

Trait MapOne 

Source
pub trait MapOne: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn map<'life0, 'async_trait>(
        &'life0 self,
        env: Envelope,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Envelope>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Ergonomic transform: “receive one, return at most one”.

Returning Ok(None) filters the envelope out. BasicTransform wraps a MapOne into a Transform with the standard loop and error policy.

Required Methods§

Source

fn id(&self) -> &str

Source

fn map<'life0, 'async_trait>( &'life0 self, env: Envelope, ) -> Pin<Box<dyn Future<Output = Result<Option<Envelope>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§