Skip to content

Read and write the variable length LEB128 number format.

License

Notifications You must be signed in to change notification settings

danleh/wasabi_leb128

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wasabi_leb128 build status

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:

About

Read and write the variable length LEB128 number format.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages