Crate integer_encoding[−][src]
Fast serialization of integers.
use integer_encoding::*; fn main() { let a: u32 = 344; let encoded_byte_slice = a.encode_fixed_light(); assert_eq!(a, u32::decode_fixed(encoded_byte_slice)); assert_eq!(4, encoded_byte_slice.len()); let b: i32 = -111; let encoded_byte_vec = b.encode_var_vec(); assert_eq!((b, 2), i32::decode_var(&encoded_byte_vec)); }
Traits
FixedInt | FixedInt provides encoding/decoding to and from fixed int representations. The emitted bytestring contains the bytes of the integer in machine endianness. |
FixedIntAsyncReader | Like FixedIntReader, but returns a future. |
FixedIntAsyncWriter | |
FixedIntReader | A trait for reading FixedInts from any other |
FixedIntWriter | A trait for writing integers without encoding (i.e. |
VarInt | Varint (variable length integer) encoding, as described in https://developers.google.com/protocol-buffers/docs/encoding. Uses zigzag encoding (also described there) for signed integer representation. |
VarIntAsyncReader | Like a VarIntReader, but returns a future. |
VarIntAsyncWriter | Like VarIntWriter, but asynchronous. |
VarIntReader | A trait for reading VarInts from any other |
VarIntWriter | A trait for writing integers in VarInt encoding to any |