Struct ion_rs::binary::raw_binary_writer::RawBinaryWriter
source · 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>
impl<W: Write> RawBinaryWriter<W>
pub fn clear_annotations(&mut self)
pub fn has_annotations(&self) -> bool
pub fn write_symbol_id(&mut self, symbol_id: SymbolId) -> IonResult<()>
pub fn set_field_id(&mut self, field_id: SymbolId)
sourcepub fn output_mut(&mut self) -> &mut W
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.
pub fn add_annotation<A: AsRawSymbolTokenRef>(&mut self, annotation: A)
Trait Implementations§
source§impl<W: Write> IonWriter for RawBinaryWriter<W>
impl<W: Write> IonWriter for RawBinaryWriter<W>
source§fn write_null(&mut self, ion_type: IonType) -> IonResult<()>
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<()>
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<()>
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<()>
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<()>
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<()>
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<()>
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<()>
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<()>
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<()>
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<()>
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
type Output = W
source§fn ion_version(&self) -> (u8, u8)
fn ion_version(&self) -> (u8, u8)
source§fn write_ion_version_marker(&mut self, major: u8, minor: u8) -> IonResult<()>
fn write_ion_version_marker(&mut self, major: u8, minor: u8) -> IonResult<()>
source§fn supports_text_symbol_tokens(&self) -> bool
fn supports_text_symbol_tokens(&self) -> bool
true
if this RawWriter supports writing field names, annotations, and
symbol values directly as text; otherwise, returns false
. Read moresource§fn set_annotations<I, A>(&mut self, annotations: I)where
A: AsRawSymbolTokenRef,
I: IntoIterator<Item = A>,
fn set_annotations<I, A>(&mut self, annotations: I)where A: AsRawSymbolTokenRef, I: IntoIterator<Item = A>,
source§fn write_symbol<A: AsRawSymbolTokenRef>(&mut self, value: A) -> IonResult<()>
fn write_symbol<A: AsRawSymbolTokenRef>(&mut self, value: A) -> IonResult<()>
symbol
with the specified value to the output stream.source§fn write_string<S: AsRef<str>>(&mut self, value: S) -> IonResult<()>
fn write_string<S: AsRef<str>>(&mut self, value: S) -> IonResult<()>
string
with the specified value to the output stream.source§fn write_clob<A: AsRef<[u8]>>(&mut self, value: A) -> IonResult<()>
fn write_clob<A: AsRef<[u8]>>(&mut self, value: A) -> IonResult<()>
clob
with the specified value to the output stream.source§fn write_blob<A: AsRef<[u8]>>(&mut self, value: A) -> IonResult<()>
fn write_blob<A: AsRef<[u8]>>(&mut self, value: A) -> IonResult<()>
blob
with the specified value to the output stream.source§fn set_field_name<A: AsRawSymbolTokenRef>(&mut self, name: A)
fn set_field_name<A: AsRawSymbolTokenRef>(&mut self, name: A)
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>
fn parent_type(&self) -> Option<IonType>
None
. Otherwise, returns
Some(_)
with the parent container’s IonType.source§fn depth(&self) -> usize
fn depth(&self) -> usize
source§fn output_mut(&mut self) -> &mut Self::Output
fn output_mut(&mut self) -> &mut Self::Output
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<W> ElementWriter for Wwhere
W: IonWriter,
impl<W> ElementWriter for Wwhere W: IonWriter,
source§fn write_element(&mut self, element: &Element) -> Result<(), IonError>
fn write_element(&mut self, element: &Element) -> Result<(), IonError>
Element
as a top-level value.