pub trait EofReadExactExt: Read {
// Required method
fn eof_read_exact<E>(&mut self, buf: &mut [u8]) -> Result<bool, E>
where E: From<Error>;
// Provided methods
fn eof_read_be_i16<E>(&mut self) -> Result<Option<i16>, E>
where E: From<Error> { ... }
fn eof_read_be_i32<E>(&mut self) -> Result<Option<i32>, E>
where E: From<Error> { ... }
fn eof_read_be_i64<E>(&mut self) -> Result<Option<i64>, E>
where E: From<Error> { ... }
fn eof_read_be_f32<E>(&mut self) -> Result<Option<f32>, E>
where E: From<Error> { ... }
fn eof_read_be_f64<E>(&mut self) -> Result<Option<f64>, E>
where E: From<Error> { ... }
fn eof_read_be_c64<E>(&mut self) -> Result<Option<Complex<f32>>, E>
where E: From<Error> { ... }
}
Expand description
Extend the Read
trait to provide functions for reading an exact number
of bytes from a stream and distinguishing whether EOF was encountered
immediately, versus whether it was encountered in the midst of the read.
Required Methods§
Sourcefn eof_read_exact<E>(&mut self, buf: &mut [u8]) -> Result<bool, E>
fn eof_read_exact<E>(&mut self, buf: &mut [u8]) -> Result<bool, E>
Like Read::read_exact
, except returns Ok(false) if EOF was
encountered at the first read attempt. Returns Ok(true) if everything
was OK and EOF has not yet been hit. Returns Err with an IoError with
a “kind” of UnexpectedEof if EOF was encountered somewhere in the
midst of the buffer.
Provided Methods§
Sourcefn eof_read_be_i16<E>(&mut self) -> Result<Option<i16>, E>
fn eof_read_be_i16<E>(&mut self) -> Result<Option<i16>, E>
Like byteorder::ReadBytesExt::read_i16::<BigEndian>
, except returns
Some(n) on success and None if EOF was encountered at the first read
attempt.
Sourcefn eof_read_be_i32<E>(&mut self) -> Result<Option<i32>, E>
fn eof_read_be_i32<E>(&mut self) -> Result<Option<i32>, E>
Like byteorder::ReadBytesExt::read_i32::<BigEndian>
, except returns
Some(n) on success and None if EOF was encountered at the first read
attempt.
Sourcefn eof_read_be_i64<E>(&mut self) -> Result<Option<i64>, E>
fn eof_read_be_i64<E>(&mut self) -> Result<Option<i64>, E>
Like byteorder::ReadBytesExt::read_i64::<BigEndian>
, except returns
Some(n) on success and None if EOF was encountered at the first read
attempt.
Sourcefn eof_read_be_f32<E>(&mut self) -> Result<Option<f32>, E>
fn eof_read_be_f32<E>(&mut self) -> Result<Option<f32>, E>
Like byteorder::ReadBytesExt::read_f32::<BigEndian>
, except returns
Some(n) on success and None if EOF was encountered at the first read
attempt.
Sourcefn eof_read_be_f64<E>(&mut self) -> Result<Option<f64>, E>
fn eof_read_be_f64<E>(&mut self) -> Result<Option<f64>, E>
Like byteorder::ReadBytesExt::read_f64::<BigEndian>
, except returns
Some(n) on success and None if EOF was encountered at the first read
attempt.
Sourcefn eof_read_be_c64<E>(&mut self) -> Result<Option<Complex<f32>>, E>
fn eof_read_be_c64<E>(&mut self) -> Result<Option<Complex<f32>>, E>
Like byteorder::ReadBytesExt::read_f32::<BigEndian>
, except it reads
two values and packs them into a Complex<f32>
, and returns Some(n)
on success and None if EOF was encountered at the first read attempt.
The real part comes before the imaginary part.
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.