Skip to main content

EgressSink

Trait EgressSink 

Source
pub(crate) trait EgressSink {
    // Required methods
    fn write_all(
        &mut self,
        buf: &[u8],
    ) -> impl Future<Output = Result<(), EgressError>> + Send;
    fn reset(&mut self, code: u64) -> Result<(), EgressError>;
}
Expand description

The write half this module drives.

A trait rather than a bare &mut SendStream for exactly one reason: the ordering, clamping, terminal and cancellation behaviour below is then testable in-process against a recording sink, with no QUIC handshake and no timing. The only production implementor is SendStream.

write_all returns impl Future + Send rather than being an async fn: the forwarding tasks are spawned onto a multi-threaded runtime, so every future this module builds has to be Send, and an async fn in a trait carries no such bound.

Required Methods§

Source

fn write_all( &mut self, buf: &[u8], ) -> impl Future<Output = Result<(), EgressError>> + Send

Hand buf to the transport.

Source

fn reset(&mut self, code: u64) -> Result<(), EgressError>

Abandon the stream with code, discarding anything still in the local send buffer.

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 EgressSink for SendStream

Source§

async fn write_all(&mut self, buf: &[u8]) -> Result<(), EgressError>

Source§

fn reset(&mut self, code: u64) -> Result<(), EgressError>

Implementors§