pub struct StructBuilder { /* private fields */ }
Expand description

Builder for StructArray

Note that callers should make sure that methods of all the child field builders are properly called to maintain the consistency of the data structure.

Implementations§

source§

impl StructBuilder

source

pub fn new( fields: impl Into<Fields>, field_builders: Vec<Box<dyn ArrayBuilder>> ) -> Self

Creates a new StructBuilder

source

pub fn from_fields(fields: impl Into<Fields>, capacity: usize) -> Self

Creates a new StructBuilder from Fields and capacity

source

pub fn field_builder<T: ArrayBuilder>(&mut self, i: usize) -> Option<&mut T>

Returns a mutable reference to the child field builder at index i. Result will be None if the input type T provided doesn’t match the actual field builder’s type.

source

pub fn num_fields(&self) -> usize

Returns the number of fields for the struct this builder is building.

source

pub fn append(&mut self, is_valid: bool)

Appends an element (either null or non-null) to the struct. The actual elements should be appended for each child sub-array in a consistent way.

source

pub fn append_null(&mut self)

Appends a null element to the struct.

source

pub fn finish(&mut self) -> StructArray

Builds the StructArray and reset this builder.

source

pub fn finish_cloned(&self) -> StructArray

Builds the StructArray without resetting the builder.

Trait Implementations§

source§

impl ArrayBuilder for StructBuilder

source§

fn len(&self) -> usize

Returns the number of array slots in the builder.

Note that this always return the first child field builder’s length, and it is the caller’s responsibility to maintain the consistency that all the child field builder should have the equal number of elements.

source§

fn finish(&mut self) -> ArrayRef

Builds the array.

source§

fn finish_cloned(&self) -> ArrayRef

Builds the array without resetting the builder.

source§

fn as_any(&self) -> &dyn Any

Returns the builder as a non-mutable Any reference.

This is most useful when one wants to call non-mutable APIs on a specific builder type. In this case, one can first cast this into a Any, and then use downcast_ref to get a reference on the specific builder.

source§

fn as_any_mut(&mut self) -> &mut dyn Any

Returns the builder as a mutable Any reference.

This is most useful when one wants to call mutable APIs on a specific builder type. In this case, one can first cast this into a Any, and then use downcast_mut to get a reference on the specific builder.

source§

fn into_box_any(self: Box<Self>) -> Box<dyn Any>

Returns the boxed builder as a box of Any.

source§

fn is_empty(&self) -> bool

Returns whether number of array slots is zero
source§

impl Debug for StructBuilder

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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