Skip to main content

InStream

Struct InStream 

Source
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>

Source

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.

Source

pub fn code_sets(&self) -> CodeSets

The transmission code sets of the connection.

Source

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.

Source

pub fn read<T: CdrDecode>(&mut self) -> Result<T, SystemException>

Reads a value with its CdrDecode implementation.

Source

pub fn read_string(&mut self) -> Result<String, SystemException>

Reads a string in the negotiated char code set.

Source

pub fn read_wchar(&mut self) -> Result<u16, SystemException>

Reads a wchar (one UTF-16 code unit).

Source

pub fn read_wstring(&mut self) -> Result<String, SystemException>

Reads a wstring.

Source

pub fn read_object(&mut self) -> Result<Option<ObjectRef>, SystemException>

Reads an object reference; a nil reference is None.

Source

pub fn read_char_value(&mut self) -> Result<char, SystemException>

Reads a char in the negotiated char code set.

Source

pub fn read_typecode(&mut self) -> Result<TypeCode, SystemException>

Reads a TypeCode.

Source

pub fn read_value(&mut self, tc: &TypeCode) -> Result<Value, SystemException>

Reads a value of type tc.

Source

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.

Source

pub fn read_any(&mut self) -> Result<Any, SystemException>

Reads an any.

Source

pub fn marshal_error(&self) -> SystemException

MARSHAL with the completion status of the stream.

Source

pub fn completion_status(&self) -> CompletionStatus

The completion status errors of this stream carry: yes for a reply, no for request arguments.

Source

pub fn is_empty(&self) -> bool

Whether every byte of the body was read.

Methods from Deref<Target = Decoder<'a>>§

Source

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.

Source

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.

Source

pub fn byte_order(&self) -> ByteOrder

The byte order of the stream.

Source

pub fn version(&self) -> CdrVersion

The GIOP version whose CDR rules apply.

Source

pub fn position(&self) -> usize

The stream offset of the next byte.

Source

pub fn remaining(&self) -> usize

Bytes left to read.

Source

pub fn is_empty(&self) -> bool

Whether every byte has been read.

Source

pub fn remaining_bytes(&self) -> &'a [u8] ⓘ

The bytes left to read, without consuming them.

Source

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.

Source

pub fn skip(&mut self, n: usize) -> Result<(), Error>

Skips n bytes.

Source

pub fn read_octets(&mut self, n: usize) -> Result<&'a [u8], Error>

Reads n raw octets without alignment.

Source

pub fn read_octet(&mut self) -> Result<u8, Error>

Reads an octet.

Source

pub fn read_bool(&mut self) -> Result<bool, Error>

Reads a boolean. Octets other than 0 and 1 are rejected.

Source

pub fn read_char(&mut self) -> Result<u8, Error>

Reads a char as a single octet in the transmission code set.

Source

pub fn read_i16(&mut self) -> Result<i16, Error>

Reads a short.

Source

pub fn read_u16(&mut self) -> Result<u16, Error>

Reads an unsigned short.

Source

pub fn read_i32(&mut self) -> Result<i32, Error>

Reads a long.

Source

pub fn read_u32(&mut self) -> Result<u32, Error>

Reads an unsigned long.

Source

pub fn read_i64(&mut self) -> Result<i64, Error>

Reads a long long.

Source

pub fn read_u64(&mut self) -> Result<u64, Error>

Reads an unsigned long long.

Source

pub fn read_f32(&mut self) -> Result<f32, Error>

Reads a float.

Source

pub fn read_f64(&mut self) -> Result<f64, Error>

Reads a double.

Source

pub fn read_long_double(&mut self) -> Result<LongDouble, Error>

Reads a long double: 16 octets on an 8 octet boundary.

Source

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.

Source

pub fn read_octet_seq(&mut self) -> Result<&'a [u8], Error>

Reads a sequence<octet> without copying.

Source

pub fn set_shared(&mut self, buf: &'a Arc<Vec<u8>>)

Tells the decoder that its bytes lie in buf, so that read_octet_seq_shared can share them.

Source

pub fn read_octet_seq_shared(&mut self) -> Result<Octets, Error>

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.

Source

pub fn read_octets_shared(&mut self, len: usize) -> Result<Octets, Error>

Reads len raw octets like read_octet_seq_shared reads a sequence’s.

Source

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.

Source

pub fn read_string(&mut self) -> Result<String, Error>

Reads a string as UTF-8.

Source

pub fn read_wchar(&mut self) -> Result<u16, Error>

Reads a wchar holding one UTF-16 code unit.

Source

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.

Source

pub fn read_encapsulation(&mut self) -> Result<Decoder<'a>, Error>

Reads an encapsulation and returns a decoder over its contents.

Source

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.

Source

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.

Trait Implementations§

Source§

impl<'a> Debug for InStream<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Deref for InStream<'a>

Source§

type Target = Decoder<'a>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Decoder<'a>

Dereferences the value.
Source§

impl DerefMut for InStream<'_>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Drop for InStream<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for InStream<'a>

§

impl<'a> !Send for InStream<'a>

§

impl<'a> !Sync for InStream<'a>

§

impl<'a> !UnwindSafe for InStream<'a>

§

impl<'a> Freeze for InStream<'a>

§

impl<'a> Unpin for InStream<'a>

§

impl<'a> UnsafeUnpin for InStream<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.