#dfinity #internet-computer #canister #ic #subcanister #messagepack

bity-ic-serializer

Description spécifique de la crate

1 unstable release

0.1.0 Mar 14, 2025

#2 in #subcanister

Download history 119/week @ 2025-03-12

119 downloads per month

MIT license

5KB

Module for serialization and deserialization using MessagePack format.

This module provides utilities for efficiently serializing and deserializing data using the MessagePack format, which is a binary serialization format that is more compact than JSON and supports more data types.

Example

use std::io::Cursor;
use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct Person {
    name: String,
    age: u32,
}

let person = Person {
    name: "Alice".to_string(),
    age: 30,
};

let mut buffer = Vec::new();
serialize(&person, &mut buffer).unwrap();

let deserialized: Person = deserialize(Cursor::new(&buffer)).unwrap();
assert_eq!(person, deserialized);

Dependencies

~470–790KB
~15K SLoC