DataSource

Trait DataSource 

Source
pub trait DataSource {
    type Item: Copy + PartialEq;

    // Required method
    fn read(&mut self, _: &mut [Self::Item]) -> Result<usize>;
}
Expand description

Abstraction over io::Read, Iterator and others.

Required Associated Types§

Source

type Item: Copy + PartialEq

The type of items this data source produces.

Required Methods§

Source

fn read(&mut self, _: &mut [Self::Item]) -> Result<usize>

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§