Skip to main content

Read

Trait Read 

Source
pub trait Read {
    // Required method
    fn read(&mut self, buf: &mut [u8]) -> Result<usize>;

    // Provided methods
    fn read_exact(&mut self, buf: &mut [u8]) -> Result<()> { ... }
    fn read_to_end(&mut self, out: &mut Vec<u8>) -> Result<usize> { ... }
    fn take(self, limit: u64) -> Take<Self>
       where Self: Sized { ... }
    fn by_ref(&mut self) -> &mut Self
       where Self: Sized { ... }
    fn bytes(self) -> Bytes<Self> 
       where Self: Sized { ... }
}

Required Methods§

Source

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

Provided Methods§

Source

fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>

Source

fn read_to_end(&mut self, out: &mut Vec<u8>) -> Result<usize>

Source

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Source

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Source

fn bytes(self) -> Bytes<Self>
where Self: Sized,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Read for &[u8]

Source§

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

Source§

impl<R: Read + ?Sized> Read for &mut R

Source§

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

Implementors§

Source§

impl<R: Read> Read for Take<R>

Source§

impl<T: AsRef<[u8]>> Read for Cursor<T>