1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//! CDR (Common Data Representation) encoder and decoder.
//!
//! Handles primitive and constructed IDL types with GIOP alignment rules
//! and both byte orders.
//!
//! - [`Encoder`] and [`Decoder`] read 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.
//! - [`CdrEncode`] and [`CdrDecode`] map Rust types to IDL types: integers
//! and floats to their IDL counterparts, [`String`] to `string`, [`Vec`] to
//! `sequence`, and fixed-size arrays to IDL arrays.
//!
//! - [`Octets`] is a `sequence<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.
/// Octet sequences at least this long are shared rather than copied, by
/// [`Decoder::read_octet_seq_shared`] and
/// [`Encoder::write_octet_seq_shared`]. Shorter ones are cheaper to copy,
/// and a short slice should not keep a large message buffer alive.
pub const SHARE_MIN: usize = 4096;
pub use ;
pub use Encoder;
pub use ;
pub use LongDouble;
pub use Octets;
pub use ;
pub use ValueHeader;
/// Byte order of a CDR stream.
/// The GIOP version whose CDR rules a stream follows.
///
/// The versions differ only in how `wchar` and `wstring` are encoded:
/// GIOP 1.0 has no wide characters, GIOP 1.1 encodes them as aligned
/// fixed-width code units, and GIOP 1.2 encodes them as octet sequences.