serde-diff
A small helper that can
- Serialize the fields that differ between two structs of the same type
- Apply previously serialized field differences to other structs.
The SerdeDiff trait impl can serialize field paths recursively, greatly reducing the amount of data that needs to be serialized when only a small part of a struct has changed.
Status
Works for most basic use-cases. Includes derive macro, some standard library type implementations and deep serde integration. Supports diffing Vec. Supports both text and binary serde formats.
Usage
On a struct:
Serialize & apply differences:
bincode
let bincode_data = serialize.unwrap;
config
.deserialize_seed
.unwrap;
serde_json
let json_data = to_string.unwrap;
let mut deserializer = from_str;
apply.unwrap;
Simple example
Cargo.toml
[]
= "0.1.2"
= "1"
= "1" // all serde formats are supported, serde_json is shown in this example
main.rs
use ;
use ;
Contribution
All contributions are assumed to be dual-licensed under MIT/Apache-2.
License
Distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT.