Crates.io | binver |
lib.rs | binver |
version | 0.1.1 |
source | src |
created_at | 2021-06-20 04:56:43.679903 |
updated_at | 2021-06-20 09:12:41.964111 |
description | Binary (de)serialization framework that is backwards compatible with versioned fields. |
homepage | |
repository | https://github.com/trangar/binver |
max_upload_size | |
id | 412292 |
size | 44,814 |
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);
Licensed under either of
at your option.
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.