StreamHandler

Trait StreamHandler 

Source
pub trait StreamHandler<C: Codec>: Send + Sync {
    // Required methods
    fn handle<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: Message<C>,
        sender: ServerStreamSender<C>,
        codec: &'life1 C,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn method_name(&self) -> &str;
}

Required Methods§

Source

fn handle<'life0, 'life1, 'async_trait>( &'life0 self, request: Message<C>, sender: ServerStreamSender<C>, codec: &'life1 C, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn method_name(&self) -> &str

Implementors§

Source§

impl<F, Fut, C> StreamHandler<C> for FnStreamHandler<F, C>
where F: Fn(Message<C>, ServerStreamSender<C>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static, C: Codec + Default,

Source§

impl<Req, Item, F, S, C> StreamHandler<C> for TypedStreamHandler<Req, Item, F, C>
where Req: for<'de> Deserialize<'de> + Send + Sync + 'static, Item: Serialize + Send + Sync + 'static, S: Stream<Item = Result<Item>> + Send + 'static, F: Fn(Req) -> S + Send + Sync + 'static, C: Codec + Default,