varintrs 0.2.1

A Rust implementation of Golang Variable-Length Integers
Documentation
  • Coverage
  • 0%
    0 out of 35 items documented0 out of 30 items with examples
  • Size
  • Source code size: 15.87 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 440.44 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • szuwgh/varintrs
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • szuwgh

varintrs

A Rust implementation of Golang Variable-Length Integers

Notes:

This is a rust implementation of golang variable-length integers. Variable-length integers are usually used in writing database storage, which can compress integer data storage and save disk space.

For example:

use std::io::Cursor;
use varintrs::{Binary, ReadBytesVarExt};

let mut rdr = Cursor::new(vec![228, 211, 247, 161, 22]);
let (v, x) = rdr.read_vu64::<Binary>();
assert_eq!(5976746468, v);
assert_eq!(5, x);
use std::io::Cursor;
use varintrs::{Binary,WriteBytesVarExt};

let mut rdr = Cursor::new(vec![0u8; 7]);
rdr.write_vu64::<Binary>(88748464645454).unwrap();
assert!(rdr.get_ref().eq(&vec![206, 202, 214, 229, 245, 150, 20]));