pub struct OutStream<'a> { /* private fields */ }Expand description
The stream request arguments are written to.
It dereferences to the CDR Encoder of the message body, and adds
the operations that depend on the connection: string in the
negotiated code set, wchar and wstring only when a wide code set was
negotiated, and object references.
Implementations§
Source§impl<'a> OutStream<'a>
impl<'a> OutStream<'a>
Sourcepub fn standalone(enc: &'a mut Encoder) -> OutStream<'a>
pub fn standalone(enc: &'a mut Encoder) -> OutStream<'a>
A stream over enc outside any message, with the native code
sets (UTF-8 and UTF-16). Bindings use it to marshal the value of an
any on its own, to read it back with InStream::standalone.
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 write_string(&mut self, s: &str) -> Result<(), SystemException>
pub fn write_string(&mut self, s: &str) -> Result<(), SystemException>
Writes a string in the negotiated char code set.
Sourcepub fn write_wchar(&mut self, c: u16) -> Result<(), SystemException>
pub fn write_wchar(&mut self, c: u16) -> Result<(), SystemException>
Writes a wchar (one UTF-16 code unit).
Sourcepub fn write_wstring(&mut self, s: &str) -> Result<(), SystemException>
pub fn write_wstring(&mut self, s: &str) -> Result<(), SystemException>
Writes a wstring.
Sourcepub fn write_object(
&mut self,
obj: Option<&ObjectRef>,
) -> Result<(), SystemException>
pub fn write_object( &mut self, obj: Option<&ObjectRef>, ) -> Result<(), SystemException>
Writes an object reference; None is a nil reference.
Sourcepub fn write_typecode(&mut self, tc: &TypeCode) -> Result<(), SystemException>
pub fn write_typecode(&mut self, tc: &TypeCode) -> Result<(), SystemException>
Writes a TypeCode. An unresolved recursive placeholder is
BAD_TYPECODE.
Sourcepub fn write_value(
&mut self,
tc: &TypeCode,
v: &Value,
) -> Result<(), SystemException>
pub fn write_value( &mut self, tc: &TypeCode, v: &Value, ) -> Result<(), SystemException>
Writes a value of type tc. A value that does not fit the type is
BAD_PARAM.
Sourcepub fn write_fixed(
&mut self,
digits: &[u8],
negative: bool,
) -> Result<(), SystemException>
pub fn write_fixed( &mut self, digits: &[u8], negative: bool, ) -> Result<(), SystemException>
Writes a fixed of digits.len() digits (each 0 to 9, most
significant first) as packed decimal. A digit over 9 or more than
31 digits is BAD_PARAM.
Methods from Deref<Target = Encoder>§
Sourcepub fn set_wstring_bom(&mut self, bom: bool)
pub fn set_wstring_bom(&mut self, bom: bool)
Chooses how a GIOP 1.2 wstring is written: with a BOM followed by
code units in the stream byte order (the default, as omniORB does),
or, when false, big endian without a BOM (the form the
specification defines for a missing BOM). Readers that follow
CORBA 2.4 or later accept both.
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 as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
The bytes written into the buffer so far: all of them, unless shared octets were kept apart.
Sourcepub fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
pub fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
Mutable access to the buffer, for patching lengths. Indexes are buffer indexes, which differ from stream offsets after shared octets.
Sourcepub fn truncate(&mut self, len: usize)
pub fn truncate(&mut self, len: usize)
Drops bytes past len, which must not be before shared octets.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Makes room for at least additional more bytes in the buffer.
Lets write_octet_seq_shared
keep large octet sequences apart from the buffer. Only for an
encoder whose result goes out through
into_parts or
into_bytes, not one read through
as_bytes.
Sourcepub fn align(&mut self, align: usize)
pub fn align(&mut self, align: usize)
Pads with zero octets until the stream offset is a multiple of align.
Sourcepub fn write_octet(&mut self, value: u8)
pub fn write_octet(&mut self, value: u8)
Writes an octet.
Sourcepub fn write_bool(&mut self, value: bool)
pub fn write_bool(&mut self, value: bool)
Writes a boolean.
Sourcepub fn write_char(&mut self, value: u8)
pub fn write_char(&mut self, value: u8)
Writes a char as a single octet in the transmission code set.
Sourcepub fn write_long_double(&mut self, value: LongDouble)
pub fn write_long_double(&mut self, value: LongDouble)
Writes a long double: 16 octets on an 8 octet boundary.
Sourcepub fn write_octets(&mut self, bytes: &[u8])
pub fn write_octets(&mut self, bytes: &[u8])
Writes raw octets without alignment or a length.
Writes a sequence<octet> without copying a large one, if the
encoder allows it and no valuetype is
being written (whose chunk lengths count the buffer). Otherwise
like write_octet_seq.
Sourcepub fn write_string_bytes(&mut self, bytes: &[u8]) -> Result<(), Error>
pub fn write_string_bytes(&mut self, bytes: &[u8]) -> Result<(), Error>
Writes a string from bytes already in the transmission code set.
The length includes the terminating NUL, which is appended here.
Sourcepub fn write_wchar(&mut self, value: u16) -> Result<(), Error>
pub fn write_wchar(&mut self, value: u16) -> Result<(), Error>
Writes a wchar holding one UTF-16 code unit.
GIOP 1.1 writes an aligned unsigned short in the stream byte order.
GIOP 1.2 writes an octet length of 2 followed by the code unit in big
endian without a BOM, as omniORB does.
Sourcepub fn write_wstring(&mut self, value: &str) -> Result<(), Error>
pub fn write_wstring(&mut self, value: &str) -> Result<(), Error>
Writes a wstring encoded as UTF-16.
GIOP 1.1 writes the number of code units including a terminating
NUL, then aligned code units in the stream byte order. GIOP 1.2
writes the octet length, then the code units without a terminator:
by default a BOM followed by the stream byte order, or big endian
without a BOM (see Encoder::set_wstring_bom). An empty string is
just a zero length.
Sourcepub fn write_encapsulation<F>(&mut self, f: F) -> Result<(), Error>
pub fn write_encapsulation<F>(&mut self, f: F) -> Result<(), Error>
Writes an encapsulation as a sequence<octet>.
f writes the contents into a fresh encoder whose alignment starts
at the byte order octet. The encapsulation uses this stream’s byte
order and version.
Sourcepub fn write_null_value(&mut self)
pub fn write_null_value(&mut self)
Writes a null value.
Sourcepub fn begin_value(
&mut self,
key: u64,
ids: &[&str],
chunked: bool,
) -> Result<bool, Error>
pub fn begin_value( &mut self, key: u64, ids: &[&str], chunked: bool, ) -> Result<bool, Error>
Starts writing a value.
key identifies the value: if a value with the same key was
written before in this stream, an indirection to it is written and
false is returned. Otherwise the value tag and ids (repository
ids, most derived first; none leaves the type to the receiver) are
written and true is returned: the caller writes the state and
then calls Encoder::end_value.
A value nested in a chunked value is chunked as well.