Transmog implementation of the Bincode format.
This crate provides a Format
trait implementation using the Bincode
type:
```rust use transmog::Format; use transmog_bincode::Bincode;
let bincode = Bincode::default(); let serialized = bincode.serialize(&42u64).unwrap(); let deserialized: u64 = bincode.deserialize(&serialized).unwrap(); asserteq!(deserialized, 42); ```
Bincode::default()
returns an instance configured to be equivalent to using
bincode::DefaultOptions
.
If you're working with existing data that used the global
serialization/deserialization methods, use Bincode::legacy_default()
instead:
```rust use transmog::Format; use transmog_bincode::Bincode;
let bincode = Bincode::legacydefault(); let serialized = bincode.serialize(&42u64).unwrap(); let deserialized: u64 = bincode.deserialize(&serialized).unwrap(); assert_eq!(deserialized, 42); ```
Bincode offers all configuration options bincode exposes.
This project, like all projects from Khonsu Labs, are open-source. This repository is available under the MIT License or the Apache License 2.0.
To learn more about contributing, please see CONTRIBUTING.md.