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_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)
fn read_var<T>(&mut self) -> Result<T, Error>where
T: VarInt,
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,
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>
fn read_string(&mut self) -> Result<&str, Error>
Read string of variable length.
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.