Skip to main content

Module codec

Module codec 

Source
Available on crate feature transport only.
Expand description

§Parse-on-demand codec

The spine frames bytes into a WorkBatch WITHOUT parsing. A transform/router that needs a field parses on demand here, format- agnostic.

§Native, no JSON bridge

No rmp_serde -> serde_json::Value -> sonic_rs double-parse anywhere on the parse path. Both arms decode natively:

  • JSONsonic_rs (SIMD, AVX2/NEON).
  • MsgPackrmpv schema-less Value decoder. No intermediate serde_json::Value, no JSON re-serialise.

§Unified routing-field accessor

A router keys off ONE field and must not branch on wire format. ParsedPayload exposes a format-agnostic accessor:

Scope: top-level object-key lookup only. No deep JSON-path (YAGNI – keys live at the top level).

See docs/MIGRATIONS.md and docs/SELF-REGULATION.md. Block contract in WorkBatch.

Enums§

CodecError
A parse failure, tagged by the format that failed.
FieldRef
A borrowed view of one routing field, format-agnostic.
ParsedPayload
A parsed payload, retaining its native value representation.

Functions§

parse
Parse a framed payload into a native ParsedPayload.
to_json_bytes
Serialise a JSON value to bytes via sonic_rs (SIMD), no bridge.
to_msgpack_bytes
Serialise a MsgPack value to bytes via NATIVE rmpv::encode::write_value.