gvli

Crates.iogvli
lib.rsgvli
version1.0.0
created_at2025-11-16 21:28:23.367624+00
updated_at2025-11-16 21:28:23.367624+00
descriptionGeneralized variable-length integers
homepage
repositoryhttps://github.com/cigix/gvli
max_upload_size
id1935933
size51,351
Clément Gillard (cigix)

documentation

README

RFC 3492's Generalized Variable-Length Integers

RFC 3492, at section 3.3, gives a numbering system that allows for efficient representation of consecutive arbitrary numbers.

This crate is an implementation of this numbering system, in a generic fashion that can be used outside of just RFC 3492 implementations.

Example

let parameters = gvli::Parameters::from_parts(&gvli::BASE_OCTAL, &[2, 3, 5]).unwrap();

let encoded = gvli::encode(&[145, 62], &parameters);
assert_eq!(encoded, "734251");

let decoded = gvli::decode(&encoded, &parameters).unwrap();
assert_eq!(decoded, [145, 62]);

References

Commit count: 0

cargo fmt