Lebicon is a crate for encoding or decoding integers in LEB128 format.
This is accomplished by implementing the codicon
traits for all of Rust's
built-in integer types.
Run this command:
$ cargo add lebicon
```rust extern crate codicon; extern crate lebicon;
use codicon::{Decoder, Encoder}; use lebicon::Leb128; use std::io::Write;
let encoded = [198, 253, 255, 127]; let decoded = 268435142u64;
let value = u64::decode(&mut &encoded[..], Leb128).unwrap(); assert_eq!(value, decoded);
let mut value: Vec