pub struct IonCAnnotationsFieldWriterContext<'b, 'c, T: IonCAnnotationsFieldWriter + ?Sized> { /* private fields */ }Expand description
Context for writing annotations and fields in with proper reference lifetimes.
Specifically, writing annotations and fields with Ion C with
ion_writer_write_annotations/ion_writer_add_annotation and ion_writer_write_field
is particularly problematic because the lifetime of the ION_STRING
passed into that function, must be valid until a corresponding
ion_writer_write_* function is called for writing a value.
This context tracks the lifetime of the string slices that a user wants to
write as annotations and the field name along with a mutable borrow of the writer handle
and ensures that calls to ion_writer_add_annotation/ion_writer_write_field
happen before invoking the ion_writer_write_* call for the value in a lifetime correct way.
Note that this context can be thought of as a partial function for writing
annotations and/or struct fields, so doing nothing with it is simply a no-op, and performing
multiple IonCValueWriter trait method invocations
is the same as writing the field before invoking the value writing methods
(so duplicate fields would be generated in that case).
Implementations§
Source§impl<'b, 'c, T: IonCAnnotationsFieldWriter + ?Sized> IonCAnnotationsFieldWriterContext<'b, 'c, T>
impl<'b, 'c, T: IonCAnnotationsFieldWriter + ?Sized> IonCAnnotationsFieldWriterContext<'b, 'c, T>
Trait Implementations§
Source§impl<T: IonCAnnotationsFieldWriter + ?Sized> IonCValueWriter for IonCAnnotationsFieldWriterContext<'_, '_, T>
impl<T: IonCAnnotationsFieldWriter + ?Sized> IonCValueWriter for IonCAnnotationsFieldWriterContext<'_, '_, T>
Source§fn finish_container(&mut self) -> IonCResult<()>
fn finish_container(&mut self) -> IonCResult<()>
This API is not relevant for this context and will always return an error.
Source§fn write_null(&mut self, tid: ION_TYPE) -> IonCResult<()>
fn write_null(&mut self, tid: ION_TYPE) -> IonCResult<()>
null value. Read moreSource§fn write_bool(&mut self, value: bool) -> IonCResult<()>
fn write_bool(&mut self, value: bool) -> IonCResult<()>
bool value. Read moreSource§fn write_bigint(&mut self, value: &BigInt) -> IonCResult<()>
fn write_bigint(&mut self, value: &BigInt) -> IonCResult<()>
int value. Read moreSource§fn write_bigdecimal(&mut self, value: &BigDecimal) -> IonCResult<()>
fn write_bigdecimal(&mut self, value: &BigDecimal) -> IonCResult<()>
decimal value. Read moreSource§fn write_datetime(&mut self, value: &IonDateTime) -> IonCResult<()>
fn write_datetime(&mut self, value: &IonDateTime) -> IonCResult<()>
timestamp value. Read moreSource§fn write_symbol(&mut self, value: &str) -> IonCResult<()>
fn write_symbol(&mut self, value: &str) -> IonCResult<()>
symbol value. Read moreSource§fn write_string(&mut self, value: &str) -> IonCResult<()>
fn write_string(&mut self, value: &str) -> IonCResult<()>
string value. Read moreSource§fn write_clob(&mut self, value: &[u8]) -> IonCResult<()>
fn write_clob(&mut self, value: &[u8]) -> IonCResult<()>
clob value. Read moreSource§fn write_blob(&mut self, value: &[u8]) -> IonCResult<()>
fn write_blob(&mut self, value: &[u8]) -> IonCResult<()>
blob value. Read more