Module perlin::storage::compression [] [src]

This module currently provides utility methods and structs for variable byte codes as described in http://nlp.stanford.edu/IR-book/html/htmledition/variable-byte-codes-1.html.

Encode unsigned integers by using the vbyte_encode method.

Decode a bytestream by instatiating a VByteDecoder and using its iterator implementation.

Example


use perlin::utils::compression::{vbyte_encode, VByteDecoder};

let bytes = vbyte_encode(3);
let three = VByteDecoder::new(bytes.into_iter()).next().unwrap();
assert_eq!(3, three);Run

Structs

VByteDecoder

Iterator that decodes a bytestream to unsigned integers

VByteEncoded

Stores the result of a vbyte encode operation without indirection that a Vec<u8> would introduce. Can thus be used to vbyte_encode on the stack