Reader

Trait Reader 

Source
pub trait Reader {
    // Required method
    fn read_u8(&mut self) -> Result<u8>;

    // Provided methods
    fn read_presence_map(&mut self) -> Result<(u64, u8)> { ... }
    fn read_uint(&mut self) -> Result<u64> { ... }
    fn read_uint_nullable(&mut self) -> Result<Option<u64>> { ... }
    fn read_int(&mut self) -> Result<i64> { ... }
    fn read_int_nullable(&mut self) -> Result<Option<i64>> { ... }
    fn read_ascii_string(&mut self) -> Result<String> { ... }
    fn read_ascii_string_nullable(&mut self) -> Result<Option<String>> { ... }
    fn read_unicode_string(&mut self) -> Result<String> { ... }
    fn read_unicode_string_nullable(&mut self) -> Result<Option<String>> { ... }
    fn read_bytes(&mut self) -> Result<Vec<u8>> { ... }
    fn read_bytes_nullable(&mut self) -> Result<Option<Vec<u8>>> { ... }
}
Expand description

A trait that provides methods for reading basic primitive types.

Required Methods§

Source

fn read_u8(&mut self) -> Result<u8>

Do not return Error::Eof from this method. Return Error::UnexpectedEof instead.

Provided Methods§

Source

fn read_presence_map(&mut self) -> Result<(u64, u8)>

Read the presence map. Return the bitmap and the number of bits in the bitmap.

In case of error, return Error::Eof if the end of the stream is reached at the first byte of the presence map. Otherwise, return any other error, e.g.: Error::UnexpectedEof.

Source

fn read_uint(&mut self) -> Result<u64>

Source

fn read_uint_nullable(&mut self) -> Result<Option<u64>>

Source

fn read_int(&mut self) -> Result<i64>

Source

fn read_int_nullable(&mut self) -> Result<Option<i64>>

Source

fn read_ascii_string(&mut self) -> Result<String>

Source

fn read_ascii_string_nullable(&mut self) -> Result<Option<String>>

Source

fn read_unicode_string(&mut self) -> Result<String>

Source

fn read_unicode_string_nullable(&mut self) -> Result<Option<String>>

Source

fn read_bytes(&mut self) -> Result<Vec<u8>>

Source

fn read_bytes_nullable(&mut self) -> Result<Option<Vec<u8>>>

Implementations on Foreign Types§

Source§

impl Reader for Bytes

Source§

fn read_u8(&mut self) -> Result<u8>

Implementors§