barrique 1.0.1

Portable binary serialiation format
Documentation

Barrique

License Version

barrique is a schema-based binary serialization format featuring compression, metadata and streaming. The format was designed for locally storing large (>8 MiB) long-term memory objects.

Example

Most likely you'll start with implementations generated by derive macro:

use barrique::{Encode, Decode};
use barrique::frame::Frame;
use barrique::region::Seed;

#[derive(Encode, Decode, Clone, PartialEq)]
struct Bee {
    name: String,
    state: State,
    #[barrique(skip)]
    age: u8,
}

#[derive(Encode, Decode, Clone, PartialEq)]
#[barrique(tag_repr = "u8")]
enum State {
    Collecting(i32, i32),
    Buzzing {
        sound_level: u8
    },
    Sleeping
}

let bee = Bee {
    name: "Oh, hey!",
    state: State::Sleeping,
    age: 2
};
let mut dst = vec![];

let frame = Frame::new(&mut dst, Seed::new(0))
    .with_label("A beehive");
frame.encode(bee.clone());

let frame = Frame::decode(&dst, Seed::new(0))
    .expect("Failed to open a frame");
assert_eq!(frame.get_value().unwrap(), bee);

Visit Docs for more information.

Specification

Barrique serialization format specification declared here