Pluggable serialization for pamoja payloads.
Concrete wire formats - CBOR for constrained devices, Protocol Buffers, JSON,
or raw framing - implement the [Codec] trait. This crate defines the trait
and provides serde-based implementations behind feature flags:
- [
CborCodec] (featurecbor, on by default) - compact binary framing for constrained devices and metered links. - [
JsonCodec] (featurejson, on by default) - human-readable framing for interop and debugging. - [
BytesCodec] (always available) - a no-op codec that carries raw bytes.
Examples
A little-endian codec for u32 values:
use Codec;
use ;
;
let codec = LeU32;
let encoded = codec.encode.unwrap;
assert_eq!;