3 unstable releases

Uses new Rust 2024

new 0.2.0 Feb 26, 2026
0.1.1 Feb 23, 2026
0.1.0 Jan 21, 2026

#665 in Encoding


Used in 12 crates (4 directly)

BSD-3-Clause

36KB
786 lines

ootle_serde

Crates.io Documentation

serde helper modules for the Tari Ootle codebase. Each module is designed for use with #[serde(with = "")] and switches automatically between a human-readable form (JSON) and a compact binary form (CBOR, MessagePack, etc.) based on Serializer::is_human_readable.

Modules

Module Feature Human-readable Binary
hex hex hex string raw bytes
base64 base64 base64 string raw bytes
string ToString / FromStr native Serialize/Deserialize
map array of [key, value] pairs native map
duration::seconds integer seconds integer seconds
cbor_value cbor CBOR value helpers

Example

use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize)]
struct Record {
    #[serde(with = "ootle_serde::hex")]
    pub id: [u8; 32],

    #[serde(with = "ootle_serde::string")]
    pub amount: u64,

    #[serde(with = "ootle_serde::duration::seconds")]
    pub timeout: std::time::Duration,

    #[serde(with = "ootle_serde::map")]
    pub map: std::collections::HashMap<u64, String>,
}

License

BSD-3-Clause. Copyright 2026 The Tari Project.

Dependencies

~145–690KB
~13K SLoC