facet-postcard 0.50.0-rc.2

Postcard binary format for facet
Documentation

facet-postcard

Postcard binary format for facet.

This crate provides serialization and deserialization for the postcard binary format.

Serialization

Serialization supports all types that implement facet_core::Facet:

use facet::Facet;
use facet_postcard::to_vec;

#[derive(Facet)]
struct Point { x: i32, y: i32 }

let point = Point { x: 10, y: 20 };
let bytes = to_vec(&point).unwrap();

Deserialization

There is a configurable Deserializer API plus convenience functions:

use facet_postcard::from_slice;

// Postcard encoding: [length=3, true, false, true]
let bytes = &[0x03, 0x01, 0x00, 0x01];
let result: Vec<bool> = from_slice(bytes).unwrap();
assert_eq!(result, vec![true, false, true]);

Deserialization is driven by facet-format over the postcard parser, so all supported Facet shapes use the same parser/deserializer path.