Expand description
CDR (Common Data Representation) encoder and decoder.
Handles primitive and constructed IDL types with GIOP alignment rules and both byte orders.
-
EncoderandDecoderread and write primitives, strings, wide strings, sequences and encapsulations. Alignment is computed from the absolute stream offset, so a body that starts in the middle of a GIOP message keeps the alignment of the whole message. -
CdrEncodeandCdrDecodemap Rust types to IDL types: integers and floats to their IDL counterparts,Stringtostring,Vectosequence, and fixed-size arrays to IDL arrays. -
Octetsis asequence<octet>that shares its bytes: read from a message without copying (Decoder::read_octet_seq_shared) and written without copying into the message (Encoder::write_octet_seq_shared, when the encoder allows it).
Code set conversion is out of scope: string is read and written as
bytes (UTF-8 when converted to String), and wchar/wstring use
UTF-16. Negotiating other code sets is left to the ORB core.
any, TypeCode and fixed are in the ORB core, which knows the
types. long double is LongDouble, the IEEE 754 binary128 bits.
Valuetypes are written and read in pieces: Encoder::begin_value /
Encoder::end_value and Decoder::read_value_header /
Decoder::end_value handle the value tags, sharing (indirections)
and chunking, and the caller writes or reads the state members in
between.
Modules§
- xcdr
- The headers of DDS-XTypes Extended CDR (XCDR), clause 7.4 of DDS-XTypes 1.3, and the RTPS SerializedPayload header around them (DDSI-RTPS 2.5 clause 10).
Structs§
- Decoder
- Reads CDR from a byte slice.
- Encoder
- Writes CDR into a growable buffer.
- Long
Double - A
long doublevalue, kept as its IEEE 754 binary128 bits: the sign in the top bit, a 15-bit exponent biased by 16383 and a 112-bit fraction. - Octets
- A
sequence<octet>that shares its bytes instead of copying them. - Segment
- A point in a decoder’s buffer from which the stream offset restarts.
Enums§
- Byte
Order - Byte order of a CDR stream.
- Encoding
- The encoding rules a stream follows.
- Error
- Errors raised while encoding or decoding CDR.
- Value
Header - What
Decoder::read_value_headerfound where a value was expected.
Constants§
- SHARE_
MIN - Octet sequences at least this long are shared rather than copied, by
Decoder::read_octet_seq_sharedandEncoder::write_octet_seq_shared. Shorter ones are cheaper to copy, and a short slice should not keep a large message buffer alive.
Traits§
Type Aliases§
- Result
- Result type of CDR operations.