Crate bitcode

source ·
Expand description

Bitcode is a crate for encoding and decoding using a tinier binary serialization strategy. You can easily go from having an object in memory, quickly serialize it to bytes, and then deserialize it back just as fast!

The format is not necessarily stable between versions. If you want a stable format, consider bincode.

Usage

// The object that we will serialize.
let target: Vec<String> = vec!["a".to_owned(), "b".to_owned(), "c".to_owned()];

let encoded: Vec<u8> = bitcode::serialize(&target).unwrap();
let decoded: Vec<String> = bitcode::deserialize(&encoded).unwrap();
assert_eq!(target, decoded);

Structs

Functions