TRead

Trait TRead 

Source
pub trait TRead {
    // Required methods
    fn peek_byte(&self) -> Result<u8, StreamError>;
    fn peek(&self, buffer: &mut [u8]) -> Result<usize, StreamError>;
    fn read_byte(&mut self) -> Result<u8, StreamError>;
    fn read(&mut self, buffer: &mut [u8]) -> Result<usize, StreamError>;
    fn skip(&mut self, count: usize) -> usize;
    fn skip_all(&mut self) -> usize;
    fn view(&self) -> &[u8] ;
    fn available(&self) -> usize;
}

Required Methods§

Source

fn peek_byte(&self) -> Result<u8, StreamError>

Peek one byte from stream, position don’t shift.

Can return EOF error.

Source

fn peek(&self, buffer: &mut [u8]) -> Result<usize, StreamError>

Peek bytes from stream, position don’t shift.

Can return EOF, ZeroLength errors.

Source

fn read_byte(&mut self) -> Result<u8, StreamError>

Read one byte from stream, position shifted.

Can return EOF error.

Source

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

Read bytes from stream, position shifted.

Can return EOF, ZeroLength errors.

Source

fn skip(&mut self, count: usize) -> usize

Skip “count” bytes in stream, position shifted.

Source

fn skip_all(&mut self) -> usize

Skip all bytes in stream, position shifted.

Source

fn view(&self) -> &[u8]

View of available bytes in stream.

Source

fn available(&self) -> usize

Return available to read bytes.

Implementors§