Skip to main content

Module encode

Module encode 

Source
Expand description

Encoder and decoder bodies, built from the layout plan. Spec §5, §6.2.

The body of an encode is a language CST — statements, calls, casts — not a template with holes for names. A template would put the per-construct decisions back where no diff of two languages can see them, one hole at a time, which is what this rebuild took them out of.

Every framing decision is read from zerodds-ast-layout, never re-derived here. The plan is where the length-code policy and the XCDR2 alignment rule live; a second derivation would be a second place to get them wrong.

Enums§

EncodeError
Why an encoder could not be built.

Constants§

SECONDARY_SUFFIX
The name the second codec pair on a type carries.

Functions§

axes_the_codecs_carry
Refuses a layout key whose axes the non-Rust generated codecs do not carry.
axes_the_codecs_carry_for
axes_the_codecs_carry for a generated codec, which carries the axes its runtime does.
axes_the_rust_codec_carries
The same check for the Rust target, which carries every HDDS axis.
has_codec
Whether rust_codec gives a type of this kind a codec of its own: an aggregate (structure, union, valuetype), an enumeration, a bitmask or a bitset. A bitmask’s answer is empty, since its Rust form is an alias of a primitive and its member site writes the holder. Every other kind — a primitive, a string, a collection, an alias — is written where it is used and has no impl to hang a pair on.
rust_codec
Build the encode and decode functions for one type, with the Default impl and — for a keyed type — the key-holder pair.
rust_codec_pair
Build only the encode and decode pair for one type.