Trait hannibal::StreamHandler
source · [−]pub trait StreamHandler<T: 'static>: Actor {
fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut Context<Self>,
msg: T
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn started<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
{ ... }
fn finished<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
{ ... }
}
Expand description
Describes how to handle messages of a specific type.
Implementing Handler is a general way to handle incoming streams.
The type T is a stream message which can be handled by the actor.
Stream messages do not need to implement the Message
trait.
Required methods
Provided methods
Method is called when stream get polled first time.
Method is called when stream finishes.
By default this method stops actor execution.