Crate msb128

Source
Expand description

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.

Enums§

ReadError
An error type for reading MSB128 encoded integers.
WriteError
An error type for writing MSB128 encoded integers.

Functions§

read_positive
Read a variable length and MSB128-encoded integer from r. The returned integer is positive. Reading negative integers is not supported.
write_positive
Write val to the std::io::Write stream w as an MSB128-encoded integer.