pub struct BinaryReader<'a> { /* private fields */ }
Expand description
BinaryReader is used to deserialize various data types from a byte buffer.
Implementations§
Source§impl<'a> BinaryReader<'a>
impl<'a> BinaryReader<'a>
Sourcepub fn read_u16(&mut self) -> Result<u16, String>
pub fn read_u16(&mut self) -> Result<u16, String>
Reads a u16 value from the buffer in little-endian order.
Sourcepub fn read_u32(&mut self) -> Result<u32, String>
pub fn read_u32(&mut self) -> Result<u32, String>
Reads a u32 value from the buffer in little-endian order.
Sourcepub fn read_u64(&mut self) -> Result<u64, String>
pub fn read_u64(&mut self) -> Result<u64, String>
Reads a u64 value from the buffer in little-endian order.
Sourcepub fn read_i16(&mut self) -> Result<i16, String>
pub fn read_i16(&mut self) -> Result<i16, String>
Reads an i16 value from the buffer in little-endian order.
Sourcepub fn read_i32(&mut self) -> Result<i32, String>
pub fn read_i32(&mut self) -> Result<i32, String>
Reads an i32 value from the buffer in little-endian order.
Sourcepub fn read_i64(&mut self) -> Result<i64, String>
pub fn read_i64(&mut self) -> Result<i64, String>
Reads an i64 value from the buffer in little-endian order.
Sourcepub fn read_f32(&mut self) -> Result<f32, String>
pub fn read_f32(&mut self) -> Result<f32, String>
Reads a f32 value from the buffer in little-endian order.
Sourcepub fn read_f64(&mut self) -> Result<f64, String>
pub fn read_f64(&mut self) -> Result<f64, String>
Reads a f64 value from the buffer in little-endian order.
Sourcepub fn read_bool(&mut self) -> Result<bool, String>
pub fn read_bool(&mut self) -> Result<bool, String>
Reads a bool value from the buffer (expects 0 or 1).
Sourcepub fn read_string(&mut self) -> Result<String, String>
pub fn read_string(&mut self) -> Result<String, String>
Reads a string from the buffer. Expects a u32 length followed by UTF-8 bytes.
Sourcepub fn read_vec_u8(&mut self) -> Result<Vec<u8>, String>
pub fn read_vec_u8(&mut self) -> Result<Vec<u8>, String>
Reads a vector of u8 from the buffer. Expects a u32 length followed by bytes.
Sourcepub fn read_vec_u16(&mut self) -> Result<Vec<u16>, String>
pub fn read_vec_u16(&mut self) -> Result<Vec<u16>, String>
Reads a vector of u16 from the buffer. Expects a u32 length followed by u16 values.
Sourcepub fn read_vec_u32(&mut self) -> Result<Vec<u32>, String>
pub fn read_vec_u32(&mut self) -> Result<Vec<u32>, String>
Reads a vector of u32 from the buffer. Expects a u32 length followed by u32 values.
Sourcepub fn read_vec_u64(&mut self) -> Result<Vec<u64>, String>
pub fn read_vec_u64(&mut self) -> Result<Vec<u64>, String>
Reads a vector of u64 from the buffer. Expects a u32 length followed by u64 values.
Sourcepub fn read_vec_i8(&mut self) -> Result<Vec<i8>, String>
pub fn read_vec_i8(&mut self) -> Result<Vec<i8>, String>
Reads a vector of i8 from the buffer. Expects a u32 length followed by i8 values.
Sourcepub fn read_vec_i16(&mut self) -> Result<Vec<i16>, String>
pub fn read_vec_i16(&mut self) -> Result<Vec<i16>, String>
Reads a vector of i16 from the buffer. Expects a u32 length followed by i16 values.
Sourcepub fn read_vec_i32(&mut self) -> Result<Vec<i32>, String>
pub fn read_vec_i32(&mut self) -> Result<Vec<i32>, String>
Reads a vector of i32 from the buffer. Expects a u32 length followed by i32 values.
Sourcepub fn read_vec_i64(&mut self) -> Result<Vec<i64>, String>
pub fn read_vec_i64(&mut self) -> Result<Vec<i64>, String>
Reads a vector of i64 from the buffer. Expects a u32 length followed by i64 values.
Sourcepub fn read_vec_f32(&mut self) -> Result<Vec<f32>, String>
pub fn read_vec_f32(&mut self) -> Result<Vec<f32>, String>
Reads a vector of f32 from the buffer. Expects a u32 length followed by f32 values.