Trait yrs::encoding::read::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: VarInt>(&mut self) -> Result<T, Error> { ... } fn read_var_signed<T: SignedVarInt>(&mut self) -> Result<Signed<T>, Error> { ... } 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: VarInt>(&mut self) -> Result<T, Error>

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: SignedVarInt>(&mut self) -> Result<Signed<T>, Error>

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

Object Safety§

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>