Crates.io | binout |
lib.rs | binout |
version | 0.3.0 |
source | src |
created_at | 2022-07-11 20:03:20.897751 |
updated_at | 2024-10-02 08:37:14.487112 |
description | The library for binary serialization/deserialization of integers and arrays of integers. |
homepage | |
repository | https://github.com/beling/bsuccinct-rs |
max_upload_size | |
id | 623978 |
size | 15,790 |
binout
is the Rust library by Piotr Beling for low-level, portable, bytes-oriented,
binary encoding, decoding, serialization, deserialization of integers and arrays of integers.
It supports slightly improved VByte/LEB128 format (see [VByte
]) as well as simple, little-endian, as-is serialization (see [AsIs
]).
use binout::{VByte, Serializer};
let value = 123456u64;
let mut buff = Vec::new();
assert!(VByte::write(&mut buff, value).is_ok());
assert_eq!(buff.len(), VByte::size(value));
let read: u64 = VByte::read(&mut &buff[..]).unwrap();
assert_eq!(read, value);