Struct arrow::array::StructBuilder
source · [−]pub struct StructBuilder { /* private fields */ }
Expand description
Array builder for Struct types.
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
sourceimpl StructBuilder
impl StructBuilder
pub fn new(
fields: Vec<Field>,
field_builders: Vec<Box<dyn ArrayBuilder>>
) -> Self
pub fn from_fields(fields: Vec<Field>, capacity: usize) -> Self
sourcepub fn field_builder<T: ArrayBuilder>(&mut self, i: usize) -> Option<&mut T>
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.
sourcepub fn num_fields(&self) -> usize
pub fn num_fields(&self) -> usize
Returns the number of fields for the struct this builder is building.
sourcepub fn append(&mut self, is_valid: bool) -> Result<()>
pub fn append(&mut self, is_valid: bool) -> Result<()>
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.
sourcepub fn append_null(&mut self) -> Result<()>
pub fn append_null(&mut self) -> Result<()>
Appends a null element to the struct.
sourcepub fn finish(&mut self) -> StructArray
pub fn finish(&mut self) -> StructArray
Builds the StructArray
and reset this builder.
Trait Implementations
sourceimpl ArrayBuilder for StructBuilder
impl ArrayBuilder for StructBuilder
sourcefn len(&self) -> usize
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.
sourcefn as_any(&self) -> &dyn Any
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.
sourcefn as_any_mut(&mut self) -> &mut dyn Any
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.
sourcefn into_box_any(self: Box<Self>) -> Box<dyn Any>
fn into_box_any(self: Box<Self>) -> Box<dyn Any>
Returns the boxed builder as a box of Any
.
Auto Trait Implementations
impl !RefUnwindSafe for StructBuilder
impl Send for StructBuilder
impl !Sync for StructBuilder
impl Unpin for StructBuilder
impl !UnwindSafe for StructBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more