Struct VariantArrayVariantBuilder

Source
pub struct VariantArrayVariantBuilder<'a> {
    finished: bool,
    metadata_offset: usize,
    value_offset: usize,
    array_builder: &'a mut VariantArrayBuilder,
    variant_builder: VariantBuilder,
}
Expand description

A VariantBuilderExt that writes directly to the buffers of a VariantArrayBuilder.

If Self::finish is not called, any changes will be rolled back

See VariantArrayBuilder::variant_builder for an example

Fields§

§finished: bool

was finish called?

§metadata_offset: usize

starting offset in the variant_builder’s metadata buffer

§value_offset: usize

starting offset in the variant_builder’s value buffer

§array_builder: &'a mut VariantArrayBuilder

Parent array builder that this variant builder writes to. Buffers have been moved into the variant builder, and must be returned on drop

§variant_builder: VariantBuilder

Builder for the in progress variant value, temporarily owns the buffers from array_builder

Implementations§

Source§

impl<'a> VariantArrayVariantBuilder<'a>

Source

fn new( array_builder: &'a mut VariantArrayBuilder, metadata_buffer: Vec<u8>, value_buffer: Vec<u8>, ) -> Self

Constructs a new VariantArrayVariantBuilder

Note this is not public as this is a structure that is logically part of the VariantArrayBuilder and relies on its internal structure

Source

pub fn inner(&self) -> &VariantBuilder

Return a reference to the underlying VariantBuilder

Source

pub fn inner_mut(&mut self) -> &mut VariantBuilder

Return a mutable reference to the underlying VariantBuilder

Source

pub fn finish(self)

Called to finish the in progress variant and write it to the underlying buffers

Note if you do not call finish, on drop any changes made to the underlying buffers will be rolled back.

Trait Implementations§

Source§

impl<'a> Drop for VariantArrayVariantBuilder<'a>

Source§

fn drop(&mut self)

If the builder was not finished, roll back any changes made to the underlying buffers (by truncating them)

Source§

impl<'a> VariantBuilderExt for VariantArrayVariantBuilder<'a>

Source§

fn append_value<'m, 'v>(&mut self, value: impl Into<Variant<'m, 'v>>)

Source§

fn new_list(&mut self) -> ListBuilder<'_>

Source§

fn new_object(&mut self) -> ObjectBuilder<'_>

Auto Trait Implementations§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

§

impl<T> Ungil for T
where T: Send,