[][src]Crate msb128

std::io::{Read, Write} positive, primitive Rust integers in the Most Significant Base 128 (MSB128) variable-length encoding. MSB128 is also known as Variable Length Quantity (VLQ) encoding and similar to the Little Endian Base 128 (LEB128) encoding (other endianness).

Each byte is encoded into 7 bits, and one is subtracted (excluding the last byte). The highest bit indicates if more bytes follow. Reading stops after a byte with the highest bit set is read or if the underlying Rust primitive overflows.



An error type for reading MSB128 encoded integers.


An error type for writing MSB128 encoded integers.



Read a variable length and MSB128-encoded integer from r. The returned integer is positive. Reading negative integers is not supported.


Write val to the std::io::Write stream w as an MSB128-encoded integer.