#facet #messagepack #reflection #deserialize #serialization

facet-msgpack

MessagePack serialization and deserialization for Facet types

48 releases (16 breaking)

Uses new Rust 2024

new 0.25.6 May 24, 2025
0.24.5 May 12, 2025

#2592 in Encoding

Download history 366/week @ 2025-04-04 1231/week @ 2025-04-11 1157/week @ 2025-04-18 534/week @ 2025-04-25 272/week @ 2025-05-02 1049/week @ 2025-05-09 521/week @ 2025-05-16

2,438 downloads per month

MIT/Apache

770KB
15K SLoC

Facet logo - a reflection library for Rust

Coverage Status free of syn crates.io documentation MIT/Apache-2.0 licensed

Logo by Misiasart

Thanks to all individual and corporate sponsors, without whom this work could not exist:

Ko-fi GitHub Sponsors Patreon Zed Depot

Provides MessagePack serialization and deserialization for facet types.

Usage

use facet::Facet;
use facet_msgpack::to_vec;

#[derive(Facet)]
struct MyStruct {
    field1: u32,
    field2: String,
}

let my_instance = MyStruct {
    field1: 42,
    field2: "hello".to_string(),
};

// Serialize to MessagePack bytes
let bytes = to_vec(&my_instance);

println!("Serialized MessagePack: {:?}", bytes);
// Output: Serialized MessagePack: [130, 166, 102, 105, 101, 108, 100, 49, 42, 166, 102, 105, 101, 108, 100, 50, 165, 104, 101, 108, 108, 111]

// Deserialization would use from_bytes (not shown here)

License

Licensed under either of:

at your option.

Dependencies

~390KB