Built-in BSON codec (bson, behind the native-only bson feature: its
dependency tree does not build on wasm32-unknown-unknown). Self-describing
like JSON. The top-level body must be a document (struct or map).
Built-in CBOR codec (ciborium). Self-describing like JSON, so LaserData Cloud’s
projector can index its fields without a schema. Constrains the body to
Serialize / DeserializeOwned.
Encoding strategy for a typed body. Four first-party codecs ship here, all
self-describing so LaserData Cloud’s projector can index their fields without a
schema: Json (serde_json), Msgpack (rmp_serde), Cbor
(ciborium), and Bson (bson, native-only feature). For a
schema-first format (Avro or Protobuf), Arrow, or your own framing,
implement Codec on a marker type. The codec advertises its
ContentType so consumers can decode downstream.
The decode half of a codec. Separate from Codec because encoding is
?Sized (you can encode a &str) while decoding must produce an owned,
deserializable value. Json, Msgpack, Cbor, and Bson implement both.
A custom codec (Avro, Protobuf, Arrow, or your own framing) implements only
the half it needs.