Development Documentation (main branch) - For stable release docs, see docs.rs/eidetica

Read

Trait Read 

pub trait Read: Sized {
Show 13 methods // Required method fn read_exact(&mut self, len: usize) -> Result<&[u8], Error>; // Provided methods fn read_u8(&mut self) -> Result<u8, Error> { ... } fn read_buf(&mut self) -> Result<&[u8], Error> { ... } fn read_u16(&mut self) -> Result<u16, Error> { ... } fn read_u32(&mut self) -> Result<u32, Error> { ... } fn read_u32_be(&mut self) -> Result<u32, Error> { ... } fn read_var<T>(&mut self) -> Result<T, Error> where T: VarInt { ... } fn read_var_signed<T>(&mut self) -> Result<Signed<T>, Error> where T: SignedVarInt { ... } fn read_string(&mut self) -> Result<&str, Error> { ... } fn read_f32(&mut self) -> Result<f32, Error> { ... } fn read_f64(&mut self) -> Result<f64, Error> { ... } fn read_i64(&mut self) -> Result<i64, Error> { ... } fn read_u64(&mut self) -> Result<u64, Error> { ... }
}

Required Methods§

fn read_exact(&mut self, len: usize) -> Result<&[u8], Error>

Provided Methods§

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

Read a single byte.

fn read_buf(&mut self) -> Result<&[u8], Error>

Read a variable length buffer.

fn read_u16(&mut self) -> Result<u16, Error>

Read 2 bytes as unsigned integer

fn read_u32(&mut self) -> Result<u32, Error>

Read 4 bytes as unsigned integer

fn read_u32_be(&mut self) -> Result<u32, Error>

Read 4 bytes as unsigned integer in big endian order. (most significant byte first)

fn read_var<T>(&mut self) -> Result<T, Error>
where T: VarInt,

Read unsigned integer with variable length.

  • numbers < 2^7 are stored in one byte
  • numbers < 2^14 are stored in two bytes

fn read_var_signed<T>(&mut self) -> Result<Signed<T>, Error>
where T: SignedVarInt,

Read unsigned integer with variable length.

  • numbers < 2^7 are stored in one byte
  • numbers < 2^14 are stored in two bytes

fn read_string(&mut self) -> Result<&str, Error>

Read string of variable length.

fn read_f32(&mut self) -> Result<f32, Error>

Read float32 in big endian order

fn read_f64(&mut self) -> Result<f64, Error>

Read float64 in big endian order

fn read_i64(&mut self) -> Result<i64, Error>

Read BigInt64 in big endian order

fn read_u64(&mut self) -> Result<u64, Error>

read BigUInt64 in big endian order

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.

Implementors§

§

impl<'a> Read for DecoderV1<'a>

§

impl<'a> Read for DecoderV2<'a>

§

impl<'a> Read for Cursor<'a>