Crate transmog_bincode

source ·
Expand description

Transmog implementation of the Bincode format.

transmog-bincode forbids unsafe code crate version Documentation for main branch

This crate provides a Format trait implementation using the Bincode type:

use transmog::{Format, OwnedDeserializer};
use transmog_bincode::Bincode;

let bincode = Bincode::default();
let serialized = bincode.serialize(&42_u64).unwrap();
let deserialized: u64 = bincode.deserialize_owned(&serialized).unwrap();
assert_eq!(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:

use transmog::{Format, OwnedDeserializer};
use transmog_bincode::Bincode;

let bincode = Bincode::legacy_default();
let serialized = bincode.serialize(&42_u64).unwrap();
let deserialized: u64 = bincode.deserialize_owned(&serialized).unwrap();
assert_eq!(deserialized, 42);

Bincode offers all configuration options bincode exposes.

Re-exports

Structs

  • Bincode implementor of [Format] with default options.