Crate bity_ic_serializer

Crate bity_ic_serializer 

Source
Expand description

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);

Functions§

deserialize
Deserializes a value from MessagePack format using the provided reader.
serialize
Serializes a value into a MessagePack format using the provided writer.