#msgpack #deserialize #shapely #serialization #reflection #derive-debug

shapely-msgpack

MessagePack serialization and deserialization for Shapely types

3 stable releases

Uses new Rust 2024

new 3.0.0 Mar 11, 2025
2.0.1 Mar 11, 2025

#6 in #msgpack

30 downloads per month

MIT/Apache

93KB
2K SLoC

shapely-msgpack

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

[!IMPORTANT]

There is no stable shapely API as of now (even though it's >1.0.0). The design is very much still being explored.

Expect multiple major versions in the near future — (note left 2025-03-11)

A crate for deserializing MessagePack data into Shapely structures.

Example

use shapely::Shapely;
use shapely_msgpack::from_msgpack;

#[derive(Debug, Shapely, PartialEq)]
struct User {
    id: u64,
    username: String,
}

// MessagePack binary data (equivalent to {"id": 42, "username": "user123"})
let msgpack_data = [
    0x82, 0xa2, 0x69, 0x64, 0x2a, 0xa8, 0x75, 0x73,
    0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0xa7, 0x75,
    0x73, 0x65, 0x72, 0x31, 0x32, 0x33
];

let mut partial = User::partial();
from_msgpack(&mut partial, &msgpack_data).expect("Failed to parse MessagePack data");

let user = partial.build::<User>();
assert_eq!(user, User { id: 42, username: "user123".to_string() });

License

Licensed under either of:

at your option.

Dependencies