| Crates.io | shapely-msgpack |
| lib.rs | shapely-msgpack |
| version | 3.1.0 |
| created_at | 2025-03-11 13:25:22.496147+00 |
| updated_at | 2025-03-31 19:08:06.759936+00 |
| description | MessagePack serialization and deserialization for Shapely types |
| homepage | https://github.com/bearcove/shapely |
| repository | https://github.com/bearcove/shapely |
| max_upload_size | |
| id | 1587938 |
| size | 45,106 |
A crate for deserializing MessagePack data into Shapely structures.
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() });
Thanks to Namespace for providing fast GitHub Actions workers:
Licensed under either of:
at your option.