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§
Provided Methods§
sourcefn read_u32_be(&mut self) -> Result<u32, Error>
fn read_u32_be(&mut self) -> Result<u32, Error>
Read 4 bytes as unsigned integer in big endian order. (most significant byte first)
sourcefn read_var<T: VarInt>(&mut self) -> Result<T, Error>
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
sourcefn read_var_signed<T: SignedVarInt>(&mut self) -> Result<Signed<T>, Error>
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
sourcefn read_string(&mut self) -> Result<&str, Error>
fn read_string(&mut self) -> Result<&str, Error>
Read string of variable length.
Object Safety§
This trait is not object safe.