binver

Crates.iobinver
lib.rsbinver
version0.1.1
sourcesrc
created_at2021-06-20 04:56:43.679903
updated_at2021-06-20 09:12:41.964111
descriptionBinary (de)serialization framework that is backwards compatible with versioned fields.
homepage
repositoryhttps://github.com/trangar/binver
max_upload_size
id412292
size44,814
Trangar (VictorKoenders)

documentation

README

Crates.io Build status docs.io codecov

binver

Binary (de)serialization framework that is backwards compatible with versioned fields.


#[derive(Serializable, PartialEq, Debug)]
pub struct Player {
    // This field has existed since binary version 0.0.1
    #[since(0.0.1)]
    pub id: u32,

    // In 0.0.2 we introduced a new field
    // When loading a serialized 0.0.1 object, this field will have it's `Default` value
    #[since(0.0.2)]
    pub name: String,
}

let player = Player {
    id: 5,
    name: String::from("foo")
};

let serialized = binver::to_vec(&player);
let deserialized_player = binver::deserialize_slice(&serialized).unwrap();

assert_eq!(player, deserialized_player);

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 17

cargo fmt