Trait chomp::buffer::data_source::DataSource [] [src]

pub trait DataSource {
    type Item: Copy + PartialEq;
    fn read(&mut self, _: &mut [Self::Item]) -> Result<usize>;
}

Abstraction over io::Read, Iterator and others.

Associated Types

The type of items this data source produces.

Required Methods

Populates the supplied buffer with data, returns the number of items written.

Notes

  • The number returned must not be larger than the length of the supplied slice.

  • If no data could be written (or is available), or if the slice is of zero-length, Ok(0) should be returned (includes EOF).

  • The slice must not be read from, may contain uninitialized memory.

Implementors