decode

Function decode 

Source
pub fn decode(i: impl Iterator<Item = u8>) -> Result<u128, String>
Expand description

Decode a variable-length integer from a byte stream.

Since we don’t know the size of the integer, we use a u128 to store it.

§Example

use vbe::decode;
let res: u128 = decode(vec![0x7f, 0x9f].into_iter()).unwrap();
assert_eq!(res, 0x0fffu128);