[][src]Trait io::Read

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>

Important traits for Data<R, T>

impl<R: Read<T>, T: Copy> Iterator for Data<R, T> type Item = Result<T, R::Err>;

    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>

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

impl<R: Read<T>, T: Copy, P: FnMut(T) -> bool, E: From<R::Err> + From<NoMemory>> Iterator for Split<R, T, P, E> type Item = Result<Vec<T>, E>;

    where
        Self: Sized
, { ... } }

Associated Types

type Err

Loading content...

Provided methods

fn read(&mut self, buf: &mut [T]) -> Result<usize, Self::Err>

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

fn readv(&mut self, bufs: &mut [&mut [T]]) -> Result<usize, Self::Err>

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.

fn try_read_full(&mut self, buf: &mut [T]) -> Result<usize, (Self::Err, usize)>

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.

fn read_full<E: From<Self::Err> + From<EndOfFile>>(
    &mut self,
    buf: &mut [T]
) -> Result<(), (E, usize)>

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.

fn size_hint(&self) -> (usize, Option<usize>)

Return bounds on number of data ready to read.

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

fn data(self) -> Data<Self, T>

Important traits for Data<R, T>

impl<R: Read<T>, T: Copy> Iterator for Data<R, T> type Item = Result<T, R::Err>;
where
    Self: Sized

Make an Iterator over the data of this reader.

fn read_onto_vec<A: Alloc>(
    &mut self,
    xs: &mut Vec<T, A>
) -> Result<usize, Self::Err>

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.

fn split<P: FnMut(T) -> bool, E: From<Self::Err> + From<NoMemory>>(
    self,
    p: P,
    keep_delim: bool
) -> Split<Self, T, P, E>

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

impl<R: Read<T>, T: Copy, P: FnMut(T) -> bool, E: From<R::Err> + From<NoMemory>> Iterator for Split<R, T, P, E> type Item = Result<Vec<T>, E>;
where
    Self: Sized

Loading content...

Implementors

impl<'a, T: Copy, R: ?Sized + DerefMut> Read<T> for R where
    R::Target: Read<T>, 
[src]

type Err = <R::Target as Read<T>>::Err

impl<S: Copy, T: Deref<Target = [S]>> Read<S> for Pos<T>[src]

type Err = Void

Loading content...