Skip to main content

DynamicSizeBuffer

Trait DynamicSizeBuffer 

Source
pub trait DynamicSizeBuffer {
    // Required methods
    fn need_resize(&self) -> bool;
    fn dyn_resize(&mut self);
    fn update_need_size(&mut self, n: usize);
}
Expand description

Buffer for situations where the length of the data to be read is not known

Required Methods§

Source

fn need_resize(&self) -> bool

Source

fn dyn_resize(&mut self)

Dynamic capacity adjustment based on need_size

Source

fn update_need_size(&mut self, n: usize)

If the buffer is filled, it is expanded; if the buffer is not filled and the filled content is less than INIT_BUF_SIZE bytes and the need_size is greater than INIT_BUF_SIZE, it is shrunk.

§Arguments n : how many bytes were read into the

buffer this time

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§