pub trait BytesExt {
// Required methods
fn read_cstr(&mut self) -> Result<String>;
fn read_i32_be(&mut self) -> Result<i32>;
fn read_i16_be(&mut self) -> Result<i16>;
}Expand description
Extension trait for Bytes operations
Required Methods§
Sourcefn read_cstr(&mut self) -> Result<String>
fn read_cstr(&mut self) -> Result<String>
Read a null-terminated string
§Errors
Returns io::Error with InvalidData if no null terminator is found or the bytes are not valid UTF-8.
Sourcefn read_i32_be(&mut self) -> Result<i32>
fn read_i32_be(&mut self) -> Result<i32>
Read a 32-bit big-endian integer
§Errors
Returns io::Error with UnexpectedEof if fewer than 4 bytes remain.
Sourcefn read_i16_be(&mut self) -> Result<i16>
fn read_i16_be(&mut self) -> Result<i16>
Read a 16-bit big-endian integer
§Errors
Returns io::Error with UnexpectedEof if fewer than 2 bytes remain.