Expand description
The bytes back into the value.
encode.rs walks the layout plan and writes; this walks the same
plan and reads. Not a second reading of the model, for the reason the
encoder gives: two walks that decided the framing separately would
agree with each other only until one of them changed.
§What the return direction adds
Encoding is measured by comparing bytes, and a byte comparison passes
a decoder that is wrong in the same way its own encoder is wrong. A
round trip through one implementation passes such a defect every
time; a round trip through two does not. That is the whole reason
this file exists — docs/specs/zerodds-interop-suite-1.0.md §4, P2.
§Where reading needs a decision writing did not
Two places, each of which the writer never had to face:
- A union’s member. The writer takes the member the value names;
the reader has only the discriminator, so it evaluates the case
labels against it, falls back to
default:, and reads no member at all where neither matches. - The end of the stream. A decoder that stopped early would leave bytes unread and report success, which is the failure class this suite exists to find. Anything left over is an error.
Functions§
- decode
- Read
bytesasrequest.type_name, in canonical form. - decode_
continuing - As
decode, for a value that begins atstartinbytes: alignment counts from the start ofbytes, the sample. - decode_
prefix - Read one value of
request.type_namefrom the start ofbytesand say how many octets it took. - key_
holder - Decode an actual PLAIN_CDR2-BE holder using the shared member plan and defaults.
- key_
holder_ prefix - Decode a PLAIN_CDR2-BE holder from the start of
bytesand say how many octets it took; what follows is the caller’s (DDSI-RTPS 2.5 §9.6.4.8 Step 5.1: a KeyHash is the holder padded with zeros to 16 octets). - padding_
present - The number of padding octets an encapsulated payload of
payload_lenoctets (encapsulation header included) carries at its end, given the low byte of its options word. - serialized_
key - Decode the writer’s own
serializedKey(DDSI-RTPS 2.5 §9.4.2.11) — the key-only payload behind a dispose/unregister DATA’s K flag — in the representation and byte orderrequestnames. - validate_
key_ holder - Validate the currently supported inverse holder shape without reading data.