musli-storage
Super simple storage encoding for Müsli
The storage encoding is partially upgrade safe:
- ✔ Can tolerate missing fields if they are annotated with
#[musli(default)]
. - ✗ Cannot skip over extra unrecognized fields.
This means that it's suitable as a storage format, since the data model only evolves in one place. But unsuitable as a wire format since it cannot allow clients to upgrade independent of each other.
See musli-wire for a fully upgrade safe format.
use ;
let version2 = to_vec?;
assert!;
let version1 = to_vec?;
let version2: Version2 = decode?;
assert_eq!;
Configuring
To tweak the behavior of the storage format you can use the StorageEncoding type:
use ;
use DefaultMode;
use ;
const CONFIG: = new
.with_fixed_integers;
let mut out = Vec new;
let expected = Struct ;
CONFIG.encode?;
let actual = CONFIG.decode?;
assert_eq!;
License: MIT/Apache-2.0