pub trait Stream<Item>where
Self: Actor,{
// Required method
fn action(&mut self, msg: Item, ctx: &mut Context<Self>);
// Provided methods
fn started(&mut self, _ctx: &mut Context<Self>) { ... }
fn state(&mut self, _ctx: &mut Context<Self>) -> StreamingState { ... }
fn spawn_stream<S>(&mut self, ctx: &mut Context<Self>, stream: S) -> Handle
where S: Stream + 'static,
Self: Stream<S::Item> { ... }
fn aborted(&mut self, _ctx: &mut Context<Self>) { ... }
fn paused(&mut self, _ctx: &mut Context<Self>) { ... }
fn resumed(&mut self, _ctx: &mut Context<Self>) { ... }
fn finished(&mut self, _ctx: &mut Context<Self>) { ... }
}Expand description
An abstraction for Actor’s stream routine
Required Methods§
Provided Methods§
sourcefn started(&mut self, _ctx: &mut Context<Self>)
fn started(&mut self, _ctx: &mut Context<Self>)
called before the actor emit the first Strem Item
sourcefn state(&mut self, _ctx: &mut Context<Self>) -> StreamingState
fn state(&mut self, _ctx: &mut Context<Self>) -> StreamingState
change the state of stream to abort/pause/resume the stream accordingly
Real-Time control or more elaborated execution could be achieved right here
sourcefn spawn_stream<S>(&mut self, ctx: &mut Context<Self>, stream: S) -> Handlewhere
S: Stream + 'static,
Self: Stream<S::Item>,
fn spawn_stream<S>(&mut self, ctx: &mut Context<Self>, stream: S) -> Handlewhere S: Stream + 'static, Self: Stream<S::Item>,
spawn stream to the actor