Skip to main content

OctetsWriter

Trait OctetsWriter 

Source
pub trait OctetsWriter {
    type Error;

    // Required method
    fn put_bytes(&mut self, v: &[u8]) -> Result<(), Self::Error>;

    // Provided method
    fn put_huffman_encoded<const LOWER_CASE: bool>(
        &mut self,
        v: &[u8],
    ) -> Result<(), Self::Error>
       where Self: Sized { ... }
}
Expand description

A byte sink for encoders in this crate.

This lets callers use octets encoders with output targets other than a single contiguous OctetsMut buffer.

Required Associated Types§

Source

type Error

The error returned by the output sink.

Required Methods§

Source

fn put_bytes(&mut self, v: &[u8]) -> Result<(), Self::Error>

Writes v to the output sink.

Provided Methods§

Source

fn put_huffman_encoded<const LOWER_CASE: bool>( &mut self, v: &[u8], ) -> Result<(), Self::Error>
where Self: Sized,

Writes v to the output sink after HPACK Huffman-encoding it.

The Huffman code implemented is the one defined for HPACK (RFC7541).

Encoding is not atomic. An error can be returned after writing part of the output, so callers cannot safely retry unless the sink discards the partial output. Sinks that perform irreversible writes, such as sending data over the network, must buffer the output or guarantee success.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§