pub trait Reader {
Show 21 methods
// Required methods
fn read_u8(&mut self) -> Result<u8, Error>;
fn read_u16(&mut self) -> Result<u16, Error>;
fn read_u32(&mut self) -> Result<u32, Error>;
fn read_u64(&mut self) -> Result<u64, Error>;
fn read_u128(&mut self) -> Result<u128, Error>;
fn read_i8(&mut self) -> Result<i8, Error>;
fn read_i16(&mut self) -> Result<i16, Error>;
fn read_i32(&mut self) -> Result<i32, Error>;
fn read_i64(&mut self) -> Result<i64, Error>;
fn read_i128(&mut self) -> Result<i128, Error>;
fn read_f32(&mut self) -> Result<f32, Error>;
fn read_f64(&mut self) -> Result<f64, Error>;
fn read_varint(&mut self) -> Result<u64, Error>;
fn read_bytes(&mut self) -> Result<Bytes, Error>;
fn read_bytes_lte(&mut self, max: usize) -> Result<Bytes, Error>;
fn read_n_bytes(&mut self, n: usize) -> Result<Bytes, Error>;
fn read_fixed<const N: usize>(&mut self) -> Result<[u8; N], Error>;
fn read_bool(&mut self) -> Result<bool, Error>;
fn read_option<T: Codec>(&mut self) -> Result<Option<T>, Error>;
fn read_vec<T: Codec>(&mut self) -> Result<Vec<T>, Error>;
fn read_vec_lte<T: Codec>(&mut self, max: usize) -> Result<Vec<T>, Error>;
}
Expand description
Trait for codec read operations
Required Methods§
Sourcefn read_varint(&mut self) -> Result<u64, Error>
fn read_varint(&mut self) -> Result<u64, Error>
Reads a varint-encoded integer
Sourcefn read_bytes(&mut self) -> Result<Bytes, Error>
fn read_bytes(&mut self) -> Result<Bytes, Error>
Reads bytes with a length prefix
Sourcefn read_bytes_lte(&mut self, max: usize) -> Result<Bytes, Error>
fn read_bytes_lte(&mut self, max: usize) -> Result<Bytes, Error>
Reads bytes with a length prefix, with a limit on the number of bytes
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.