varintbuf
This crate provides varint encoding/decoding and is based on the varinteger crate, but is adapted for bytes.
Usage
Decode
extern crate bytes;
// decode a `u64` integer from a buffer
let mut buf = &;
let value = decode;
assert_eq!;
let mut buf = from;
let value = decode;
assert_eq!
Encode
extern crate bytes;
// encode a `u64` integer into a buffer
let mut buf = Vec new;
let mut bytes_encoded = encode;
assert_eq!;
let mut buf = from;
bytes_encoded += encode;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
License
Licensed under either of these:
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)