pub struct ValueWriter { /* private fields */ }Expand description
Writes valuetype instances with value sharing: the same Rc instance is
encoded as an indirection on the second write (one object, not two copies).
Implementations§
Source§impl ValueWriter
impl ValueWriter
Sourcepub fn write(
&mut self,
w: &mut BufferWriter,
value: Option<&Rc<dyn ValueMarshal>>,
) -> Result<(), EncodeError>
pub fn write( &mut self, w: &mut BufferWriter, value: Option<&Rc<dyn ValueMarshal>>, ) -> Result<(), EncodeError>
Writes an optional valuetype: None → null; known instance →
indirection; otherwise value_tag(single RepositoryId) + RepositoryId + state.
§Errors
CDR encode error / offset overflow.
Sourcepub fn write_with_codebase(
&mut self,
w: &mut BufferWriter,
value: Option<&Rc<dyn ValueMarshal>>,
codebase: &str,
) -> Result<(), EncodeError>
pub fn write_with_codebase( &mut self, w: &mut BufferWriter, value: Option<&Rc<dyn ValueMarshal>>, codebase: &str, ) -> Result<(), EncodeError>
Like write, but with a codebase URL (§15.3.4.1, bit 0):
value_tag 0x7fffff03, then the codebase URL, then RepositoryId + state.
The reader can use the URL via a CodebaseResolver for factory
resolution.
§Errors
CDR encode error / offset overflow.
Sourcepub fn write_chunked(
&mut self,
w: &mut BufferWriter,
value: Option<&Rc<dyn ValueMarshal>>,
base_ids: &[&str],
) -> Result<(), EncodeError>
pub fn write_chunked( &mut self, w: &mut BufferWriter, value: Option<&Rc<dyn ValueMarshal>>, base_ids: &[&str], ) -> Result<(), EncodeError>
Writes a valuetype chunked with a RepositoryId list (§15.3.4.3) —
the format that makes truncatable valuetypes interoperable over the wire
(a foreign ORB can truncate to a base). base_ids are the base
RepositoryIds (most-derived → base order); the state lies in one
chunk, terminated with end-tag -1. Byte-identical to JacORB 3.9.
§Errors
CDR encode error / offset or length overflow.
Sourcepub fn write_chunked_tree(
&mut self,
w: &mut BufferWriter,
node: &ChunkedNode<'_>,
) -> Result<(), EncodeError>
pub fn write_chunked_tree( &mut self, w: &mut BufferWriter, node: &ChunkedNode<'_>, ) -> Result<(), EncodeError>
Writes a multi-chunk valuetype tree (§15.3.4.3): a chunked value
whose body carries further chunked values at chunk boundaries, each
self-delimited by its own end-tag -level. This is the encoder
counterpart to the decoder’s nested-chunk handling: where
write_chunked emits a single flat state chunk
plus an end-tag, this emits the leading state chunk followed by the
node’s nested values — the wire a base-only reader truncates over
(consuming the derived/nested tail). A leaf node (no nested children)
is byte-identical to write_chunked.
§Errors
CDR encode error / offset or length overflow.