Trait arrow::array::ArrayBuilder [−][src]
pub trait ArrayBuilder: Any + Send { fn len(&self) -> usize; fn is_empty(&self) -> bool; fn finish(&mut self) -> ArrayRef; fn as_any(&self) -> &dyn Any; fn as_any_mut(&mut self) -> &mut dyn Any; fn into_box_any(self: Box<Self>) -> Box<dyn Any>; }
Expand description
Trait for dealing with different array builders at runtime
Example
// Create let mut data_builders: Vec<Box<dyn ArrayBuilder>> = vec![ Box::new(Float64Builder::new(1024)), Box::new(Int64Builder::new(1024)), Box::new(StringBuilder::new(1024)), ]; // Fill data_builders[0] .as_any_mut() .downcast_mut::<Float64Builder>() .unwrap() .append_value(3.14)?; data_builders[1] .as_any_mut() .downcast_mut::<Int64Builder>() .unwrap() .append_value(-1)?; data_builders[2] .as_any_mut() .downcast_mut::<StringBuilder>() .unwrap() .append_value("🍎")?; // Finish let array_refs: Vec<ArrayRef> = data_builders .iter_mut() .map(|builder| builder.finish()) .collect(); assert_eq!(array_refs[0].len(), 1); assert_eq!(array_refs[1].is_null(0), false); assert_eq!( array_refs[2] .as_any() .downcast_ref::<StringArray>() .unwrap() .value(0), "🍎" );
Required methods
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.
fn as_any_mut(&mut self) -> &mut dyn Any
[src]
fn as_any_mut(&mut self) -> &mut dyn Any
[src]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.
fn into_box_any(self: Box<Self>) -> Box<dyn Any>
[src]
fn into_box_any(self: Box<Self>) -> Box<dyn Any>
[src]Returns the boxed builder as a box of Any
.
Implementors
Returns the builder as a mutable Any
reference.
Returns the boxed builder as a box of Any
.
Returns the builder as a mutable Any
reference.
Returns the boxed builder as a box of Any
.
Returns the builder as a mutable Any
reference.
Returns the boxed builder as a box of Any
.
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.
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.
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.
Returns the boxed builder as a box of Any
.
Returns the builder as an mutable Any
reference.
Returns the boxed builder as a box of Any
.
impl<K, V> ArrayBuilder for PrimitiveDictionaryBuilder<K, V> where
K: ArrowPrimitiveType,
V: ArrowPrimitiveType,
[src]
impl<K, V> ArrayBuilder for PrimitiveDictionaryBuilder<K, V> where
K: ArrowPrimitiveType,
V: ArrowPrimitiveType,
[src]Returns the builder as an mutable Any
reference.
Returns the boxed builder as a box of Any
.
Returns the builder as a mutable Any
reference.
Returns the boxed builder as a box of Any
.
Returns the builder as a mutable Any
reference.
Returns the boxed builder as a box of Any
.
Returns the builder as a mutable Any
reference.
Returns the boxed builder as a box of Any
.