pub struct RawBinaryWriter<W: Write> { /* private fields */ }
Expand description

A system-level streaming binary Ion writer. This writer does not provide symbol table management; symbol-related operations (e.g. setting field IDs and annotations or writing symbol values) require a valid symbol ID to be provided by the caller.

To produce a valid binary Ion stream, the writer MUST call RawBinaryWriter::write_ion_version_marker before writing any data.

Implementations§

source§

impl<W: Write> RawBinaryWriter<W>

source

pub fn clear_annotations(&mut self)

source

pub fn has_annotations(&self) -> bool

source

pub fn write_symbol_id(&mut self, symbol_id: SymbolId) -> IonResult<()>

source

pub fn set_field_id(&mut self, field_id: SymbolId)

source

pub fn output(&self) -> &W

Returns a reference to the underlying io::Write implementation.

source

pub fn output_mut(&mut self) -> &mut W

Returns a mutable reference to the underlying io::Write implementation. Modifying the underlying sink is an inherently risky operation and can result in unexpected behavior. It is not recommended for most use cases.

source

pub fn add_annotation<A: AsRawSymbolTokenRef>(&mut self, annotation: A)

Trait Implementations§

source§

impl<W: Debug + Write> Debug for RawBinaryWriter<W>

source§

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

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

impl<W: Write> IonWriter for RawBinaryWriter<W>

source§

fn write_null(&mut self, ion_type: IonType) -> IonResult<()>

Writes an Ion null of the specified type.

source§

fn write_bool(&mut self, value: bool) -> IonResult<()>

Writes an Ion boolean with the specified value.

source§

fn write_i64(&mut self, value: i64) -> IonResult<()>

Writes an Ion integer with the specified value.

source§

fn write_int(&mut self, value: &Int) -> IonResult<()>

Writes an Ion integer with the specified value.

source§

fn write_f32(&mut self, value: f32) -> IonResult<()>

Writes an Ion float with the specified value.

source§

fn write_f64(&mut self, value: f64) -> IonResult<()>

Writes an Ion float with the specified value.

source§

fn write_decimal(&mut self, value: &Decimal) -> IonResult<()>

Writes an Ion decimal with the specified value.

source§

fn write_timestamp(&mut self, value: &Timestamp) -> IonResult<()>

Writes an Ion timestamp with the specified value.

source§

fn step_in(&mut self, ion_type: IonType) -> IonResult<()>

Starts a container of the specified Ion type. If ion_type is not a List, SExpression, or Struct, step_in will return an Err.

source§

fn step_out(&mut self) -> IonResult<()>

Ends the current container. If the writer is at the top level, step_out will return an Err.

source§

fn flush(&mut self) -> IonResult<()>

Writes any buffered data to the sink. This method can only be called when the writer is at the top level.

§

type Output = W

The type to which the implementor writes its data. This may be a file, a buffer, etc.
source§

fn ion_version(&self) -> (u8, u8)

Returns the (major, minor) version of the Ion stream being written. If ion_version is called before an Ion Version Marker has been emitted, the version (1, 0) will be returned.
source§

fn write_ion_version_marker(&mut self, major: u8, minor: u8) -> IonResult<()>

Writes an Ion version marker to the output stream.
source§

fn supports_text_symbol_tokens(&self) -> bool

Returns true if this RawWriter supports writing field names, annotations, and symbol values directly as text; otherwise, returns false. Read more
source§

fn set_annotations<I, A>(&mut self, annotations: I)where A: AsRawSymbolTokenRef, I: IntoIterator<Item = A>,

Sets a list of annotations that will be applied to the next value that is written.
source§

fn write_symbol<A: AsRawSymbolTokenRef>(&mut self, value: A) -> IonResult<()>

Writes an Ion symbol with the specified value to the output stream.
source§

fn write_string<S: AsRef<str>>(&mut self, value: S) -> IonResult<()>

Writes an Ion string with the specified value to the output stream.
source§

fn write_clob<A: AsRef<[u8]>>(&mut self, value: A) -> IonResult<()>

Writes an Ion clob with the specified value to the output stream.
source§

fn write_blob<A: AsRef<[u8]>>(&mut self, value: A) -> IonResult<()>

Writes an Ion blob with the specified value to the output stream.
source§

fn set_field_name<A: AsRawSymbolTokenRef>(&mut self, name: A)

Sets the current field name to name. If the TextWriter is currently positioned inside of a struct, the field name will be written before the next value. Otherwise, it will be ignored.
source§

fn parent_type(&self) -> Option<IonType>

If the writer is positioned at the top level, returns None. Otherwise, returns Some(_) with the parent container’s IonType.
source§

fn depth(&self) -> usize

Returns the number of containers that the writer has stepped into without subsequently stepping out.
source§

fn output(&self) -> &Self::Output

Returns a reference to the writer’s output. Read more
source§

fn output_mut(&mut self) -> &mut Self::Output

Returns a mutable reference to the writer’s output. Read more

Auto Trait Implementations§

§

impl<W> RefUnwindSafe for RawBinaryWriter<W>where W: RefUnwindSafe,

§

impl<W> Send for RawBinaryWriter<W>where W: Send,

§

impl<W> Sync for RawBinaryWriter<W>where W: Sync,

§

impl<W> Unpin for RawBinaryWriter<W>where W: Unpin,

§

impl<W> UnwindSafe for RawBinaryWriter<W>where W: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<W> ElementWriter for Wwhere W: IonWriter,

source§

fn write_element(&mut self, element: &Element) -> Result<(), IonError>

Serializes a single Element as a top-level value.
source§

fn write_elements<'a, I: IntoIterator<Item = &'a Element>>( &'a mut self, elements: I ) -> IonResult<()>

Serializes a collection of Element as a series of top-level values. 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.