Skip to main content

ValueStreamWriter

Struct ValueStreamWriter 

Source
pub struct ValueStreamWriter<'a> {
    pub inner: &'a mut BufferWriter,
}
Expand description

Stream API for ValueBase wire marshalling (CDR §15.3.4).

Phase 1: API skeleton that wraps zerodds_cdr::BufferReader/Writer and applies the value-tag logic (chunked encoding, repository-id list). Phase 2 wires the full spec conformance (truncatable, custom marshaling, codeset).

Fields§

§inner: &'a mut BufferWriter

Inner writer.

Implementations§

Source§

impl<'a> ValueStreamWriter<'a>

Source

pub fn new(inner: &'a mut BufferWriter) -> Self

Constructor.

Source

pub fn write_value_tag( &mut self, repository_id: &str, ) -> Result<(), EncodeError>

Writes a value-tag (CDR §15.3.4.2). Format: 0x7FFFFF02 for single-repository-id, 0x7FFFFF06 for list-of-repository- ids, 0x00000000 for null-value.

§Errors

Encode error.

Source

pub fn write_value_tag_multi( &mut self, repository_ids: &[&str], ) -> Result<(), EncodeError>

Writes a value-tag with a multi-repository-id list (CDR §15.3.4.2). Wire tag = 0x7FFF_FF06 (list-of-repository-ids + no chunked bit). Layout:

u32 tag = 0x7FFFFF06
i32 count                 // > 0
string id[0] .. id[N-1]   // CDR-strings (length + bytes + NUL)
§Errors

Encode error or empty repository_ids (spec requires N >= 1).

Source

pub fn write_chunked_value_tag( &mut self, repository_ids: &[&str], ) -> Result<(), EncodeError>

Writes a chunked value-tag (CDR §15.3.4.2 + §15.3.4.3 — “chunked encoding”). Wire tag = 0x7FFF_FF0A (chunked flag + multi-repo-id flag, both set).

After the tag come:

  1. i32 count + string id[N] (multi-repo-id-list).
  2. Per chunk: i32 chunk_size_bytes + octet chunk_data[..].
  3. Finally: i32 end_tag = -<nesting_level> (Spec §15.3.4.3 negative-level marker).

This function writes the tag header + repo IDs; the caller layer writes each chunk via Self::write_chunk and closes the ValueType with Self::write_chunked_end.

§Errors

Encode error or empty repo IDs.

Source

pub fn write_chunk(&mut self, chunk_data: &[u8]) -> Result<(), EncodeError>

Writes a single chunk within a chunked-encoded value (CDR §15.3.4.3): i32 chunk_size + raw bytes.

§Errors

Encode error.

Source

pub fn write_chunked_end( &mut self, nesting_level: u32, ) -> Result<(), EncodeError>

Writes the end-tag of a chunked-encoded value (Spec §15.3.4.3 — i32 end_tag = -<nesting_level> with nesting_level >= 1 for the outermost value).

§Errors

Encode error or nesting_level == 0.

Auto Trait Implementations§

§

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

§

impl<'a> Freeze for ValueStreamWriter<'a>

§

impl<'a> RefUnwindSafe for ValueStreamWriter<'a>

§

impl<'a> Send for ValueStreamWriter<'a>

§

impl<'a> Sync for ValueStreamWriter<'a>

§

impl<'a> Unpin for ValueStreamWriter<'a>

§

impl<'a> UnsafeUnpin for ValueStreamWriter<'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<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.