OutboundPipeline

Trait OutboundPipeline 

Source
pub trait OutboundPipeline<W> {
    // Required methods
    fn write(&self, msg: W);
    fn close(&self);
}
Expand description

Pipeline traits for inbound and outbound message processing Outbound operations for a pipeline.

The OutboundPipeline trait defines operations for pushing data from the application into the pipeline (toward the network/transport).

These methods are typically called by your application when you want to:

  • Send data over the network
  • Close the connection

§Type Parameters

  • R: The input message type (bottom of pipeline)
  • W: The write message type (top of pipeline, from application)

§Example

use sansio::{Pipeline, OutboundPipeline};

let pipeline: Pipeline<Vec<u8>, String> = Pipeline::new();
// ... add handlers ...
let pipeline = pipeline.finalize();

// Send data from application
pipeline.write("Hello, World!".to_string());
pipeline.close();

Required Methods§

Source

fn write(&self, msg: W)

Writes a message into the pipeline.

The message will flow through handlers from last to first (outbound), with each handler potentially transforming it. Eventually it can be retrieved via poll_write().

§Parameters
  • msg: The message to write (type W)
Source

fn close(&self)

Initiates pipeline close.

Sends a close event through the pipeline, allowing handlers to flush buffers and clean up resources.

Implementors§

Source§

impl<R: 'static, W: 'static> OutboundPipeline<W> for Pipeline<R, W>