#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

#2002 in Encoding

Download history 318/week @ 2024-06-19 241/week @ 2024-06-26 86/week @ 2024-07-03 349/week @ 2024-07-10 276/week @ 2024-07-17 309/week @ 2024-07-24 321/week @ 2024-07-31 375/week @ 2024-08-07 394/week @ 2024-08-14 307/week @ 2024-08-21 460/week @ 2024-08-28 385/week @ 2024-09-04 411/week @ 2024-09-11 251/week @ 2024-09-18 298/week @ 2024-09-25 298/week @ 2024-10-02

1,321 downloads per month
Used in 16 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