Expand description
JSON codec for records (feature remote, no_std + alloc compatible).
A record’s value T often has to cross a type-erasure boundary into a wire
format. AimX uses owned JSON bytes on its outbound record hot paths and
serde_json::Value where a tree is still required; no_std connectors and
local record.latest()?.as_json() calls use the same bridge. This module
provides both forms without requiring std — serde_json runs on alloc
alone, so embedded targets can opt in via the remote feature.
Two layers:
-
RemoteSerialize— the capability trait. Blanket-implemented for everyserdetype, so anyT: Serialize + DeserializeOwnedgets a JSON codec for free. This is the AimX/connector analogue of the data-contract traits (Streamable,Linkable). It lives inaimdb-corerather thanaimdb-data-contractsbecause that crate depends onaimdb-core, not the reverse — bounding a core method onStreamablewould be a dependency cycle. EveryStreamabletype satisfiesRemoteSerializeautomatically. -
JsonCodec— the object-safe, type-erased storage form, with the zero-sizedSerdeJsonCodecimplementation. A record storesOption<Arc<dyn JsonCodec<T>>>; the AimX read/write/subscribe paths andRecordValue::as_jsonroute through it. This mirrors the connector layer’s fusedSerializedSource/IngestFncallbacks.
Structs§
- Serde
Json Codec - Zero-sized serde-backed
JsonCodec.
Traits§
- Json
Codec - Type-erased JSON codec for one record type.
- Remote
Serialize - A record type that can be encoded to / decoded from the JSON wire format.