[][src]Crate fastvlq

Algorithm

Fast VLQ is a variant of value-length quantity encoding, with a focus on encoding and decoding speed. The total number of bytes can always be derived from the very first byte, and unlike VLQ, the integer type supported is u64 exclusively, and will take up a maximum of 9 bytes (for values greater than 56-bit).

This crate does not enforce an invariant that a number may only have one representation, which means that it is possible to encode 1 as, for example, both 0b1000_0001 and 0b0100_0000_0000_0001.

Usage

Add this to your Cargo.toml:

[dependencies]
fastvlq = "1"

Structs

Vu64

An unsigned 64-bit integer in value-length quantity encoding.

Traits

ReadVu64Ext

Extension trait to support reading bytes from standard reader interface as VLQ.

WriteVu64Ext

Extension trait to support writing VLQ to standard writer interface.

Functions

decode_vu64

Decode a given VLQ instance back into a native u64.

encode_vu64

Encode a u64 in value-length quantity encoding.