Skip to main content

Module serde

Module serde 

Source
Expand description

Serde helper modules for common API wire-format patterns.

Each module is designed to be used with #[serde(with = "...")].

ModuleUse case
json_stringValue ↔ stringified JSON ("{\"k\":\"v\"}")
[base64_bytes]Vec<u8> ↔ Base64 string (standard / URL-safe)
timestampDateTime<Utc> from epoch or ISO 8601, as RFC 3339
maybe_stringString-or-number coerced to a target type

Modules§

json_string
Serde module for fields that carry stringified JSON on the wire.
maybe_string
Serde module that accepts either a string or a number and coerces the value to the target type via core::str::FromStr.
timestamp
Flexible timestamp serde: deserializes from Unix epoch (integer or float) or ISO 8601 / RFC 3339 string; always serializes as an RFC 3339 string.