Skip to main content

rust_codec_pair

Function rust_codec_pair 

Source
pub fn rust_codec_pair(
    ast: &Ast,
    type_: Id<TypeNode>,
    key: LayoutKey,
) -> Result<Vec<Item>, EncodeError>
Expand description

Build only the encode and decode pair for one type.

For a second plan over a type that already has one: the Default impl and the key holder do not belong to an encoding and would be emitted twice under the same name, which Rust refuses. The key holder in particular is not a per-encoding thing at all — XTypes 1.3 §7.6.8 fixes it as PLAIN_CDR2 big-endian whatever the sample’s encoding is — so a second copy of it would be the same bytes under a name that suggests otherwise.

§Errors

As rust_codec.