Reader

Trait Reader 

Source
pub trait Reader<T>: Iterator {
    // Required methods
    fn len(&self) -> usize;
    fn pos(&self) -> usize;
    fn rollback(&mut self, amount: usize) -> Result<(), ()>;
    fn try_read(&mut self, amount: usize) -> Option<T>;

    // Provided method
    fn is_end(&self) -> bool { ... }
}
Expand description

Provides a way to effectively read an object piece by piece.

Required Methods§

Source

fn len(&self) -> usize

Length of the object being read

Source

fn pos(&self) -> usize

Current index position of the reader

Source

fn rollback(&mut self, amount: usize) -> Result<(), ()>

Reads back several pieces

Source

fn try_read(&mut self, amount: usize) -> Option<T>

Reads several pieces and encapsulates into one object

Provided Methods§

Source

fn is_end(&self) -> bool

Whether the reader has reached the end of the object

Implementors§