Trait chomp::buffer::data_source::DataSource
[−]
[src]
pub trait DataSource { type Item; fn read(&mut self, &mut [Self::Item]) -> Result<usize>; }
Abstraction over io::Read
, Iterator
and others.
Associated Types
type Item
Required Methods
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
impl<R: Read> DataSource for ReadDataSource<R>
impl<I: Iterator> DataSource for IteratorDataSource<I>