Skip to main content

Buffer

Trait Buffer 

Source
pub trait Buffer {
    // Required methods
    fn append(&mut self, chunk: &[u8]);
    fn view(&self) -> &[u8] ;
    fn advance(&mut self, bytes: usize);
}
Expand description

Buffer captures the interface we require from the piece that maintains the crate::State buffer. This buffer is intended for keeping the undecoded partial chunks.

Required Methods§

Source

fn append(&mut self, chunk: &[u8])

Append the data to the end of the buffer.

Source

fn view(&self) -> &[u8]

View the current contents of the buffer.

Source

fn advance(&mut self, bytes: usize)

Drop the given amout of bytes from the start of the buffer.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Buffer for Vec<u8>

Source§

fn append(&mut self, chunk: &[u8])

Source§

fn view(&self) -> &[u8]

Source§

fn advance(&mut self, bytes: usize)

Source§

impl Buffer for BytesMut

Available on crate feature bytes only.
Source§

fn append(&mut self, chunk: &[u8])

Source§

fn view(&self) -> &[u8]

Source§

fn advance(&mut self, bytes: usize)

Implementors§