Skip to main content

BufferSource

Trait BufferSource 

Source
pub trait BufferSource {
    // Required methods
    fn checkout(&mut self) -> Option<Checkout>;
    fn scratch(&mut self) -> Option<Vec<u8>>;
}
Expand description

The caller-supplied origin of every buffer the mux core uses.

Implementors may refuse either request at any time, including in the middle of a request. See the module documentation for what a refusal obliges the caller to do — in short, degrade one stream, never the connection.

Required Methods§

Source

fn checkout(&mut self) -> Option<Checkout>

A fixed-size buffer for wire octets: a connection’s stream-0 landing zone, or one half of a stream’s request/response pair.

None means the source is momentarily out. It is not a permanent condition and must not be treated as one.

Source

fn scratch(&mut self) -> Option<Vec<u8>>

A growable scratch buffer the core keeps for the lifetime of the connection and reuses across passes, rather than one it hands back per call.

None refuses the construction that asked for it, which propagates as a connection that is never built — the same outcome, on the same path, as Self::checkout refusing the connection’s own buffer.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§