Trait Read

Source
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§

Source

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

Provided Methods§

Source

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

Read a single byte.

Source

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

Read a variable length buffer.

Source

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

Read 2 bytes as unsigned integer

Source

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

Read 4 bytes as unsigned integer

Source

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

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

Source

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
Source

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
Source

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

Read string of variable length.

Source

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

Read float32 in big endian order

Source

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

Read float64 in big endian order

Source

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

Read BigInt64 in big endian order

Source

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§

Source§

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

Source§

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

Source§

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