pub struct InStream<'a> { /* private fields */ }Expand description
The stream a reply, a user exception or the arguments of a request are read from.
It dereferences to the CDR Decoder of the message body, and adds
the operations that depend on the connection, like OutStream.
Errors are MARSHAL (or DATA_CONVERSION), completed yes when reading
a reply and completed no when a servant reads its arguments.
Implementations§
Source§impl<'a> InStream<'a>
impl<'a> InStream<'a>
Sourcepub fn standalone(dec: Decoder<'a>, orb: Option<&'a Orb>) -> InStream<'a>
pub fn standalone(dec: Decoder<'a>, orb: Option<&'a Orb>) -> InStream<'a>
A stream over dec outside any message, with the native code sets,
as OutStream::standalone writes. Object references read belong
to orb; without one, only nil references can be read
(BAD_INV_ORDER). Errors are completed no.
Sourcepub fn preset_value(&mut self, slot: usize, v: ValueRef)
pub fn preset_value(&mut self, slot: usize, v: ValueRef)
Makes the value read at slot (the n-th value of the stream) be
read into v, replacing its state, if it has the type of v;
otherwise a new instance is made as usual. A binding uses it to
keep the instance a value it wrote already stands for.
Sourcepub fn set_code_sets(&mut self, code_sets: CodeSets)
pub fn set_code_sets(&mut self, code_sets: CodeSets)
Uses code_sets for the char and wchar data that follows, as
on a standalone stream that must match another ORB’s native code
sets.
Sourcepub fn read<T: CdrDecode>(&mut self) -> Result<T, SystemException>
pub fn read<T: CdrDecode>(&mut self) -> Result<T, SystemException>
Reads a value with its CdrDecode implementation.
Sourcepub fn read_string(&mut self) -> Result<String, SystemException>
pub fn read_string(&mut self) -> Result<String, SystemException>
Reads a string in the negotiated char code set.
Sourcepub fn read_wchar(&mut self) -> Result<u16, SystemException>
pub fn read_wchar(&mut self) -> Result<u16, SystemException>
Reads a wchar (one UTF-16 code unit).
Sourcepub fn read_wstring(&mut self) -> Result<String, SystemException>
pub fn read_wstring(&mut self) -> Result<String, SystemException>
Reads a wstring.
Sourcepub fn read_object(&mut self) -> Result<Option<ObjectRef>, SystemException>
pub fn read_object(&mut self) -> Result<Option<ObjectRef>, SystemException>
Reads an object reference; a nil reference is None.
Sourcepub fn read_char_value(&mut self) -> Result<char, SystemException>
pub fn read_char_value(&mut self) -> Result<char, SystemException>
Reads a char in the negotiated char code set.
Sourcepub fn read_typecode(&mut self) -> Result<TypeCode, SystemException>
pub fn read_typecode(&mut self) -> Result<TypeCode, SystemException>
Reads a TypeCode.
Sourcepub fn read_value(&mut self, tc: &TypeCode) -> Result<Value, SystemException>
pub fn read_value(&mut self, tc: &TypeCode) -> Result<Value, SystemException>
Reads a value of type tc.
Sourcepub fn read_fixed(
&mut self,
n: usize,
) -> Result<(Vec<u8>, bool), SystemException>
pub fn read_fixed( &mut self, n: usize, ) -> Result<(Vec<u8>, bool), SystemException>
Reads a fixed of n digits: the digits, most significant first,
and whether it is negative. A malformed digit or sign is MARSHAL.
Sourcepub fn read_any(&mut self) -> Result<Any, SystemException>
pub fn read_any(&mut self) -> Result<Any, SystemException>
Reads an any.
Sourcepub fn marshal_error(&self) -> SystemException
pub fn marshal_error(&self) -> SystemException
MARSHAL with the completion status of the stream.
Sourcepub fn completion_status(&self) -> CompletionStatus
pub fn completion_status(&self) -> CompletionStatus
The completion status errors of this stream carry: yes for a reply, no for request arguments.
Methods from Deref<Target = Decoder<'a>>§
Sourcepub fn set_segments(&mut self, segments: &'a [Segment])
pub fn set_segments(&mut self, segments: &'a [Segment])
Restarts the stream offset at the given buffer indexes. segments
must be sorted by start; bytes before the first segment keep the
offset given when the decoder was created.
Sourcepub fn set_wstring_default_order(&mut self, order: ByteOrder)
pub fn set_wstring_default_order(&mut self, order: ByteOrder)
Sets the byte order assumed for a GIOP 1.2 wstring or wchar
without a BOM. The specification says big endian, which is the
default; some ORBs use the stream byte order instead.
Sourcepub fn byte_order(&self) -> ByteOrder
pub fn byte_order(&self) -> ByteOrder
The byte order of the stream.
Sourcepub fn remaining_bytes(&self) -> &'a [u8] ⓘ
pub fn remaining_bytes(&self) -> &'a [u8] ⓘ
The bytes left to read, without consuming them.
Sourcepub fn align(&mut self, align: usize) -> Result<(), Error>
pub fn align(&mut self, align: usize) -> Result<(), Error>
Skips padding until the stream offset is a multiple of align, or
of the encoding’s max_align when that is
smaller.
Inside a chunked valuetype, a chunk that ends here is followed by
the next one: its length is read and the data aligned in it. In an
XCDR stream the offset counts from the alignment origin (see
set_origin).
Sourcepub fn origin(&self) -> usize
pub fn origin(&self) -> usize
The stream offset alignment counts from: 0 unless changed with
set_origin.
Sourcepub fn set_origin(&mut self, origin: usize)
pub fn set_origin(&mut self, origin: usize)
Makes alignment count from stream offset origin. This is the XCDR
PUSH(ORIGIN); read_parameter does it
itself.
Sourcepub fn read_octets(&mut self, n: usize) -> Result<&'a [u8], Error>
pub fn read_octets(&mut self, n: usize) -> Result<&'a [u8], Error>
Reads n raw octets without alignment.
Sourcepub fn read_octet(&mut self) -> Result<u8, Error>
pub fn read_octet(&mut self) -> Result<u8, Error>
Reads an octet.
Sourcepub fn read_bool(&mut self) -> Result<bool, Error>
pub fn read_bool(&mut self) -> Result<bool, Error>
Reads a boolean. Octets other than 0 and 1 are rejected.
Sourcepub fn read_char(&mut self) -> Result<u8, Error>
pub fn read_char(&mut self) -> Result<u8, Error>
Reads a char as a single octet in the transmission code set.
Sourcepub fn read_long_double(&mut self) -> Result<LongDouble, Error>
pub fn read_long_double(&mut self) -> Result<LongDouble, Error>
Reads a long double: 16 octets on an 8 octet boundary.
Sourcepub fn read_len(&mut self, min_element_size: usize) -> Result<usize, Error>
pub fn read_len(&mut self, min_element_size: usize) -> Result<usize, Error>
Reads a sequence length and checks that len * min_element_size
bytes are left, so a corrupt length cannot cause a huge allocation.
Sourcepub fn read_octet_seq(&mut self) -> Result<&'a [u8], Error>
pub fn read_octet_seq(&mut self) -> Result<&'a [u8], Error>
Reads a sequence<octet> without copying.
Tells the decoder that its bytes lie in buf, so that
read_octet_seq_shared can share
them.
Reads a sequence<octet> that keeps pointing into the decoder’s
buffer, when that is shared (see
set_shared) and the sequence is not short;
otherwise a copy.
Reads len raw octets like
read_octet_seq_shared reads a
sequence’s.
Sourcepub fn read_string_bytes(&mut self) -> Result<&'a [u8], Error>
pub fn read_string_bytes(&mut self) -> Result<&'a [u8], Error>
Reads a string as bytes in the transmission code set, without the
terminating NUL.
A length of 0 is not allowed by the specification but is accepted as an empty string, since some ORBs send it.
Sourcepub fn read_string(&mut self) -> Result<String, Error>
pub fn read_string(&mut self) -> Result<String, Error>
Reads a string as UTF-8.
Sourcepub fn read_wchar(&mut self) -> Result<u16, Error>
pub fn read_wchar(&mut self) -> Result<u16, Error>
Reads a wchar holding one UTF-16 code unit.
Sourcepub fn read_wstring(&mut self) -> Result<String, Error>
pub fn read_wstring(&mut self) -> Result<String, Error>
Reads a wstring encoded as UTF-16.
For GIOP 1.2 a leading BOM selects the byte order; without one the
order set by Decoder::set_wstring_default_order is used. XCDR
has an octet length and code units in the stream byte order.
Sourcepub fn read_encapsulation(&mut self) -> Result<Decoder<'a>, Error>
pub fn read_encapsulation(&mut self) -> Result<Decoder<'a>, Error>
Reads an encapsulation and returns a decoder over its contents.
Sourcepub fn read_value_header(&mut self) -> Result<ValueHeader, Error>
pub fn read_value_header(&mut self) -> Result<ValueHeader, Error>
Reads what stands where a value is expected: null, an indirection
to a value read before, or the header of a new value.
After ValueHeader::Value, the caller reads the state and then
calls Decoder::end_value.
Sourcepub fn end_value(&mut self) -> Result<(), Error>
pub fn end_value(&mut self) -> Result<(), Error>
Ends the value whose header was read last and is not yet ended.
For a chunked value, the rest of its state (chunks and nested values a truncating reader did not read) is skipped up to its end tag.
Sourcepub fn read_dheader(&mut self) -> Result<Delimited, Error>
pub fn read_dheader(&mut self) -> Result<Delimited, Error>
Reads a DHEADER (DDS-XTypes 7.4.3.4.1). Read the object, then call
end_dheader, which skips what was not
read: members that a newer version of an appendable type added.
Sourcepub fn end_dheader(&mut self, delimited: Delimited) -> Result<(), Error>
pub fn end_dheader(&mut self, delimited: Delimited) -> Result<(), Error>
Moves to the end of the object of delimited. Reading past it is
an error.
Sourcepub fn read_member_header(&mut self) -> Result<MemberHeader, Error>
pub fn read_member_header(&mut self) -> Result<MemberHeader, Error>
Reads the EMHEADER of a member of an XCDR2 mutable type
(DDS-XTypes 7.4.3.4.2) and leaves the decoder at the member. Read
it or not, then call end_member.
With length codes 5 to 7, NEXTINT is also the first 4 octets of the member (rule 22), so the decoder is left on it, and the length counts it: 4 + NEXTINT, 4 + 4 × NEXTINT or 4 + 8 × NEXTINT octets.
Sourcepub fn end_member(&mut self, header: MemberHeader) -> Result<(), Error>
pub fn end_member(&mut self, header: MemberHeader) -> Result<(), Error>
Moves to the end of the member of header. Reading past it is an
error.
Sourcepub fn read_parameter_header(&mut self) -> Result<Parameter, Error>
pub fn read_parameter_header(&mut self) -> Result<Parameter, Error>
Reads a parameter header of XCDR1 (DDS-XTypes 7.4.1.2), short or
extended, and makes alignment count from the byte after it. Read
the member or not, then call
end_parameter.
This reads the header in front of an optional member of a final or
appendable type, where a length of 0 means the member is absent.
In a parameter list use read_parameter,
which knows its end.
Sourcepub fn read_parameter(
&mut self,
list_end: ListEnd,
) -> Result<Option<Parameter>, Error>
pub fn read_parameter( &mut self, list_end: ListEnd, ) -> Result<Option<Parameter>, Error>
Reads the next parameter header of an XCDR1 parameter list, or
None at its end. Parameters with PID_IGNORE are skipped. The
list ends with PID_LIST_END (with any flags), or for
ListEnd::Rtps also with PID_SENTINEL.