Crates.io | wasabi_leb128 |
lib.rs | wasabi_leb128 |
version | 0.4.0 |
source | src |
created_at | 2019-10-02 14:20:08.973378 |
updated_at | 2020-03-06 17:29:08.089561 |
description | Read and write the variable length LEB128 number format. |
homepage | |
repository | https://github.com/danleh/wasabi_leb128 |
max_upload_size | |
id | 169377 |
size | 25,881 |
Read and write the variable length LEB128 number format. For example:
use wasabi_leb128::{ReadLeb128, WriteLeb128};
// Vec<u8> as byte-oriented reader/writer.
let mut buf = Vec::new();
// Encoding/writing a u16 as an LEB128 byte sequence.
let original_value: u16 = 128;
buf.write_leb128(original_value).unwrap();
assert_eq!(buf, [0x80, 0x01]);
// Decoding/reading an LEB128 number back to a u16.
let value: u16 = buf.as_slice().read_leb128().unwrap();
assert_eq!(value, original_value);
For more info, see: