Struct arrow::array::BooleanBuilder
source · [−]pub struct BooleanBuilder { /* private fields */ }
Expand description
Array builder for fixed-width primitive types
Example
Create a BooleanArray
from a BooleanBuilder
use arrow::array::{Array, BooleanArray, BooleanBuilder};
let mut b = BooleanBuilder::new(4);
b.append_value(true);
b.append_null();
b.append_value(false);
b.append_value(true);
let arr = b.finish();
assert_eq!(4, arr.len());
assert_eq!(1, arr.null_count());
assert_eq!(true, arr.value(0));
assert!(arr.is_valid(0));
assert!(!arr.is_null(0));
assert!(!arr.is_valid(1));
assert!(arr.is_null(1));
assert_eq!(false, arr.value(2));
assert!(arr.is_valid(2));
assert!(!arr.is_null(2));
assert_eq!(true, arr.value(3));
assert!(arr.is_valid(3));
assert!(!arr.is_null(3));
Implementations
sourceimpl BooleanBuilder
impl BooleanBuilder
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the capacity of this builder measured in slots of type T
sourcepub fn append_value(&mut self, v: bool) -> Result<()>
pub fn append_value(&mut self, v: bool) -> Result<()>
Appends a value of type T
into the builder
sourcepub fn append_null(&mut self) -> Result<()>
pub fn append_null(&mut self) -> Result<()>
Appends a null slot into the builder
sourcepub fn append_option(&mut self, v: Option<bool>) -> Result<()>
pub fn append_option(&mut self, v: Option<bool>) -> Result<()>
Appends an Option<T>
into the builder
sourcepub fn append_slice(&mut self, v: &[bool]) -> Result<()>
pub fn append_slice(&mut self, v: &[bool]) -> Result<()>
Appends a slice of type T
into the builder
sourcepub fn append_values(
&mut self,
values: &[bool],
is_valid: &[bool]
) -> Result<()>
pub fn append_values(
&mut self,
values: &[bool],
is_valid: &[bool]
) -> Result<()>
Appends values from a slice of type T
and a validity boolean slice
sourcepub fn finish(&mut self) -> BooleanArray
pub fn finish(&mut self) -> BooleanArray
Builds the BooleanArray and reset this builder.
Trait Implementations
sourceimpl ArrayBuilder for BooleanBuilder
impl ArrayBuilder for BooleanBuilder
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.
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 BooleanBuilder
impl Send for BooleanBuilder
impl Sync for BooleanBuilder
impl Unpin for BooleanBuilder
impl UnwindSafe for BooleanBuilder
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