#varint #protobuf #integer #variables #nodejs

varinteger

Rust module for encoding/decoding varints that doesn't do any IO. Inspired by the Node.js varint module

6 stable releases

Uses old Rust 2015

1.0.6 Jul 10, 2018
1.0.4 May 29, 2018
1.0.3 May 24, 2018
1.0.2 Jan 17, 2016

#1167 in Encoding

Download history 397/week @ 2024-04-08 548/week @ 2024-04-15 512/week @ 2024-04-22 393/week @ 2024-04-29 352/week @ 2024-05-06 408/week @ 2024-05-13 332/week @ 2024-05-20 338/week @ 2024-05-27 350/week @ 2024-06-03 203/week @ 2024-06-10 346/week @ 2024-06-17 285/week @ 2024-06-24 96/week @ 2024-07-01 293/week @ 2024-07-08 296/week @ 2024-07-15 296/week @ 2024-07-22

1,020 downloads per month
Used in 13 crates (3 directly)

MIT license

6KB
94 lines

varinteger

Rust module for encoding/decoding varints that doesn't do any IO. Inspired by the Node.js varint module.

build status

Usage

extern crate varinteger;

let mut buf = [0; 512];

// encode 1000 as a varint into buf. returns how many bytes it wrote
let bytes_encoded = varinteger::encode(1000, buf);

let mut value = 0u64;
let bytes_decoded = varinteger::decode(buf, &mut value);

println!("encoded and decoded {}", value);

License

MIT

No runtime deps