[][src]Trait rubbl_core::io::EofReadExactExt

pub trait EofReadExactExt: Read {
    fn eof_read_exact<E>(&mut self, buf: &mut [u8]) -> Result<bool, E>
    where
        E: From<Error>
; 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>
, { ... } }

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

fn eof_read_exact<E>(&mut self, buf: &mut [u8]) -> Result<bool, E> where
    E: From<Error>, 

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.

Loading content...

Provided methods

fn eof_read_be_i16<E>(&mut self) -> Result<Option<i16>, E> where
    E: From<Error>, 

Like byteorder::ReadBytesExt::read_i16::<BigEndian>, except returns Some(n) on success and None if EOF was encountered at the first read attempt.

fn eof_read_be_i32<E>(&mut self) -> Result<Option<i32>, E> where
    E: From<Error>, 

Like byteorder::ReadBytesExt::read_i32::<BigEndian>, except returns Some(n) on success and None if EOF was encountered at the first read attempt.

fn eof_read_be_i64<E>(&mut self) -> Result<Option<i64>, E> where
    E: From<Error>, 

Like byteorder::ReadBytesExt::read_i64::<BigEndian>, except returns Some(n) on success and None if EOF was encountered at the first read attempt.

fn eof_read_be_f32<E>(&mut self) -> Result<Option<f32>, E> where
    E: From<Error>, 

Like byteorder::ReadBytesExt::read_f32::<BigEndian>, except returns Some(n) on success and None if EOF was encountered at the first read attempt.

fn eof_read_be_f64<E>(&mut self) -> Result<Option<f64>, E> where
    E: From<Error>, 

Like byteorder::ReadBytesExt::read_f64::<BigEndian>, except returns Some(n) on success and None if EOF was encountered at the first read attempt.

fn eof_read_be_c64<E>(&mut self) -> Result<Option<Complex<f32>>, E> where
    E: From<Error>, 

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.

Loading content...

Implementors

impl<R: Read> EofReadExactExt for R[src]

Loading content...