Trait buf_redux::strategy::ReadStrategy [] [src]

pub trait ReadStrategy: Default + Debug {
    fn should_read(&self, start: usize, end: usize, buf_size: usize) -> bool;
}

Trait for types which BufReader can consult to determine when it should read more data into the buffer.

Required Methods

fn should_read(&self, start: usize, end: usize, buf_size: usize) -> bool

Returns true if the buffer should read more data, false otherwise.

Parameters:

  • start: The starting index of the valid data region in the buffer (inclusive).
  • end: The ending index of the valid data region in the buffer (exclusive).
  • buf_size: The total size of the buffer.

end - start = number of valid bytes in the buffer.

Implementors may assume end - start >= 0

Implementors