facet-msgpack
MsgPack binary format for facet.
This crate provides serialization and deserialization for the MessagePack binary format.
Serialization
use Facet;
use to_vec;
let point = Point ;
let bytes = to_vec.unwrap;
Deserialization
There are two deserialization functions:
from_slice: Deserializes into owned types (T: Facet<'static>)from_slice_borrowed: Deserializes with zero-copy borrowing from the input bufferfrom_slice_into: Deserializes into an existingPartial(type-erased, owned)from_slice_into_borrowed: Deserializes into an existingPartial(type-erased, zero-copy)
use Facet;
use from_slice;
// MsgPack encoding of {"x": 10, "y": 20}
let bytes = &;
let point: Point = from_slice.unwrap;
assert_eq!;
assert_eq!;
Both functions use Tier-2 JIT for compatible types (when the jit feature is enabled),
with automatic fallback to Tier-0 reflection for all other types.