Module binary_util::interfaces
source · Expand description
Provides a panic-free way to read and write binary data. All of the methods within this module follow the protobuf specification at https://protobuf.dev/programming-guides/encoding/.
Example
use binary_util::io::ByteReader;
const VARINT: &[u8] = &[255, 255, 255, 255, 7]; // 2147483647
fn main() {
let mut buf = ByteReader::from(&VARINT[..]);
assert_eq!(buf.read_var_u32().unwrap(), 2147483647);
}
Traits
- Allows you to read from a
ByteReader
without needing to know the type. - Deprecated
- Allows you to write to a
ByteWriter
without needing to know the type.