Trait meio::handlers::Consumer [−][src]
pub trait Consumer<T: 'static>: Actor { #[must_use] fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
item: T,
ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait; #[must_use] fn finished<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait, { ... } #[must_use] fn task_failed<'life0, 'life1, 'async_trait>(
&'life0 mut self,
err: TaskError,
_ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait, { ... } #[must_use] fn task_finished<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait, { ... } }
Represents a capability to receive message from a Stream
.
Required methods
#[must_use]fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
item: T,
ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
#[must_use]
fn handle<'life0, 'life1, 'async_trait>(&'life0 mut self,
item: T,
ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
The method called when the next item received from a Stream
.
If you need chunks here (group multiple items into chunks) than
wrap your stream with ready_chunks
method.
Provided methods
#[must_use]fn finished<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
[src]
#[must_use]
fn finished<'life0, 'life1, 'async_trait>(&'life0 mut self,
_ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
When the stream consumed completely.
Called after the last item in the stream only.
#[must_use]fn task_failed<'life0, 'life1, 'async_trait>(
&'life0 mut self,
err: TaskError,
_ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
[src]
#[must_use]
fn task_failed<'life0, 'life1, 'async_trait>(&'life0 mut self,
err: TaskError,
_ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
The stream was failed.
#[must_use]fn task_finished<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
[src]
#[must_use]
fn task_finished<'life0, 'life1, 'async_trait>(&'life0 mut self,
_ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
When the stream task was finished sucessfully.
You should prefer to use finished
instead of this, because it’s service
event with the high-priority and it can overtake ordinary stream items.