#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

#1106 in Encoding

Download history 266/week @ 2024-07-21 307/week @ 2024-07-28 323/week @ 2024-08-04 429/week @ 2024-08-11 320/week @ 2024-08-18 437/week @ 2024-08-25 368/week @ 2024-09-01 461/week @ 2024-09-08 268/week @ 2024-09-15 315/week @ 2024-09-22 291/week @ 2024-09-29 310/week @ 2024-10-06 251/week @ 2024-10-13 665/week @ 2024-10-20 3341/week @ 2024-10-27 1657/week @ 2024-11-03

5,922 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