Trait io::Read[][src]

pub trait Read<T: Copy> {
    type Err;
    fn read(&mut self, buf: &mut [T]) -> Result<usize, Self::Err> { ... }
fn readv(&mut self, bufs: &mut [&mut [T]]) -> Result<usize, Self::Err> { ... }
fn try_read_full(
        &mut self,
        buf: &mut [T]
    ) -> Result<usize, (Self::Err, usize)> { ... }
fn read_full<E: From<Self::Err> + From<EndOfFile>>(
        &mut self,
        buf: &mut [T]
    ) -> Result<(), (E, usize)> { ... }
fn size_hint(&self) -> (usize, Option<usize>) { ... }
fn data(self) -> Data<Self, T>
    where
        Self: Sized
, { ... }
fn read_onto_vec<A: Alloc>(
        &mut self,
        xs: &mut Vec<T, A>
    ) -> Result<usize, Self::Err> { ... }
fn split<P: FnMut(T) -> bool, E: From<Self::Err> + From<NoMemory>>(
        self,
        p: P,
        keep_delim: bool
    ) -> Split<Self, T, P, E>
    where
        Self: Sized
, { ... } }

Associated Types

Provided Methods

r.read(buf) = self.readv(&mut [buf])

Pull some data, at most bufs.fold(0, |n, buf| n+buf.len()), from this source into given buffers; return how many data were actually read, or a failure. May block if no data can be read when called.

If this returns 0 data read, the possibilities are these:

  • bufs.all(|buf| buf.len() == 0)
  • The reader reached some end, and can unlikely produce further bytes, at least temporarily.

Pull buf.len() data from this source into given buffer; return how many data were actually read (which may be less than buf.len() if we reached end-of-file), or a failure and how many data were read before the failure.

Pull buf.len() data from this source into given buffer; return () if so many data were actually read, or a failure and how many data were read before the failure.

Return bounds on number of data ready to read.

The default returns (0 None) which is never wrong.

Important traits for Data<R, T>

Make an Iterator over the data of this reader.

Pull data from this source into the spare storage of xs, and modify its length to include the data read. If this fails, xs is unmodified.

Important traits for Split<R, T, P, E>

Implementors