Crates.io | varinteger |
lib.rs | varinteger |
version | 1.0.6 |
source | src |
created_at | 2016-01-17 14:55:38.026897 |
updated_at | 2018-07-10 15:22:38.616663 |
description | Rust module for encoding/decoding varints that doesn't do any IO. Inspired by the Node.js varint module |
homepage | |
repository | https://github.com/mafintosh/varinteger-rs |
max_upload_size | |
id | 3908 |
size | 6,722 |
Rust module for encoding/decoding varints that doesn't do any IO. Inspired by the Node.js varint module.
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);
MIT