Skip to main content

FrameSink

Trait FrameSink 

Source
pub trait FrameSink:
    Clone
    + Send
    + 'static {
    // Required method
    fn send(&self, frame: SessionFrame) -> Result<(), SessionFrame>;
}
Expand description

A sink the pump writes outbound SessionFrames to.

send is blocking: a bounded implementation stalls the pump’s reader thread when the consumer is slow, which lets the child’s OS pipe fill and backpressures the child. That is what keeps a fast producer (rustc) within bounded per-channel memory while staying byte-exact — the sink never drops output, it slows the producer (soldr#2365: “bounded per-channel memory asserted”, byte-exact fidelity). Err(()) means the receiver is gone and the pump should stop.

Implemented for the unbounded Sender (the handoff / test path, where the consumer drains eagerly) and the bounded SyncSender (the daemon path, where backpressure is required). The daemon adds an impl for a bounded async channel sender so the same pump feeds an async transport.

Required Methods§

Source

fn send(&self, frame: SessionFrame) -> Result<(), SessionFrame>

Send one frame, blocking if the sink is bounded and full. On failure the receiver is gone; the un-sent frame is returned (as std’s channels do via SendError) so the caller can stop pumping.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl FrameSink for Sender<SessionFrame>

Source§

impl FrameSink for SyncSender<SessionFrame>

Implementors§