[][src]Trait seq_io::policy::BufPolicy

pub trait BufPolicy: Send + Sync {
    fn grow(&mut self, current_size: usize) -> usize;

    fn limit(&self) -> Option<usize> { ... }
fn grow_limited(&mut self, current_size: usize) -> Option<usize> { ... } }

Policy that configures how the internal buffer grows upon encountering large sequences that don't fit into the current buffer.

Required methods

fn grow(&mut self, current_size: usize) -> usize

Takes the current buffer size in bytes and returns the new size the the buffer should grow to. This function is called every time the buffer has to be enlarged.

Loading content...

Provided methods

fn limit(&self) -> Option<usize>

Returns a buffer limit, if any. Called every time the buffer has to be enlarged. If the new buffer size (as calculated based on the call to grow()) exceeds the given limit, the readers will return an error of ErrorKind::BufferLimit.

fn grow_limited(&mut self, current_size: usize) -> Option<usize>

Combines grow() and limit() into one call. Takes the current buffer size and returns the new size, unless it is larger than the limit.

Loading content...

Implementors

impl BufPolicy for DoubleUntil[src]

impl BufPolicy for DoubleUntilLimited[src]

impl BufPolicy for StdPolicy[src]

Loading content...