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 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 version(&self) -> CdrVersion
pub fn version(&self) -> CdrVersion
The GIOP version whose CDR rules apply.
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.
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.
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.
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.