Skip to main content

OutHandler

Trait OutHandler 

Source
pub trait OutHandler: Send {
    // Provided methods
    fn on_pull(
        &mut self,
        _logic: &mut GraphStageLogic,
        _outlet: AnyOutlet,
    ) -> StreamResult<()> { ... }
    fn keep_handler(&self) -> bool { ... }
    fn on_downstream_finish(
        &mut self,
        logic: &mut GraphStageLogic,
        _outlet: AnyOutlet,
    ) -> StreamResult<()> { ... }
}
Expand description

Reacts to events on one outlet. The default on_downstream_finish completes the whole stage; override any method a stage needs.

Provided Methods§

Source

fn on_pull( &mut self, _logic: &mut GraphStageLogic, _outlet: AnyOutlet, ) -> StreamResult<()>

Downstream requested an element — push one if available, or pull upstream to obtain it.

Source

fn keep_handler(&self) -> bool

Whether this handler stays installed after dispatch (the emit helpers return false once their work is done so the previous handler is restored).

Source

fn on_downstream_finish( &mut self, logic: &mut GraphStageLogic, _outlet: AnyOutlet, ) -> StreamResult<()>

Downstream cancelled. Default: complete the whole stage.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§