ReadExt

Trait ReadExt 

Source
pub trait ReadExt: Read {
    // Provided method
    fn try_read_exact<const N: usize>(&mut self) -> Result<Option<[u8; N]>> { ... }
}
Expand description

Extension trait for Read.

Provided Methods§

Source

fn try_read_exact<const N: usize>(&mut self) -> Result<Option<[u8; N]>>

Reads the exact number of bytes, like read_exact, but returns None if it gets EOF at the start of the read. In other words, this is the “all or nothing” version of read.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<R: ?Sized + Read> ReadExt for R