Crate herolib_otoml

Crate herolib_otoml 

Source
Expand description

§OTOML - Canonical TOML Serialization

This crate provides OTOML serialization functionality and canonical types:

  • OTime - UTC timestamp (4 bytes)
  • OCur - Currency amount (integer micro-units)
  • OLocation - Geographic location (10 bytes)
  • OAddress - Planet-scale civic address

It also provides serialization functions:

§OtomlSerialize Trait

The OtomlSerialize trait provides convenient instance methods for any type that implements Serialize + DeserializeOwned:

use herolib_otoml::OtomlSerialize;

let user = User::default();

// Instance methods
let otoml = user.to_otoml()?;
let json = user.to_json()?;

// Factory methods
let user = User::from_otoml(&otoml)?;
let user = User::from_json(&json)?;

Structs§

OAddress
Planet-scale civic address.
OAddressRef
External reference identifiers for address lookup.
OCur
Canonical currency/asset amount type.
OLocation
Canonical geographic location with uncertainty radius.
OTime
Canonical UTC timestamp with second precision.

Enums§

OtomlError
Errors that can occur during OTOML serialization or deserialization.

Constants§

MICRO_UNITS
Scale factor: 1 unit = 1,000,000 micro-units

Traits§

OtomlSerialize
Extension trait providing OTOML and JSON serialization methods.

Functions§

dump_obin
Serialize a value to compact OBIN binary format.
dump_otoml
Serialize a value to canonical OTOML text string.
load_obin
Deserialize OBIN binary data into a value.
load_otoml
Deserialize an OTOML/TOML text string into a value.
normalize_keys
Normalize keys in a TOML string to snake_case.

Type Aliases§

Result
Result type alias for OTOML operations.