pub struct Validity(/* private fields */);Expand description
An optional validity mask. None (the dense default) means every value is
present with no allocation; Some carries a Bitmap with at least one
missing value. The invariant “Some ⇒ has a missing value” is upheld by the
constructors so equality and has_nulls stay cheap and canonical.
Implementations§
Source§impl Validity
impl Validity
Sourcepub fn from_bitmap(bm: Bitmap) -> Validity
pub fn from_bitmap(bm: Bitmap) -> Validity
Wrap a bitmap, collapsing an all-present one back to dense so the dense fast path is always taken when there are no missing values.
Sourcepub fn from_valid_iter(
len: usize,
valid: impl IntoIterator<Item = bool>,
) -> Validity
pub fn from_valid_iter( len: usize, valid: impl IntoIterator<Item = bool>, ) -> Validity
Build from an iterator of valid flags; dense when all are present.
Sourcepub fn is_valid(&self, i: usize) -> bool
pub fn is_valid(&self, i: usize) -> bool
Whether element i is present. Dense ⇒ always true. i in bounds.
Sourcepub fn set(&mut self, i: usize, len: usize, valid: bool)
pub fn set(&mut self, i: usize, len: usize, valid: bool)
Set element i’s presence in place (one cell). Dense stays dense when
marking present; a bitmap is materialized only when a first missing value is
introduced. len is the column length, needed to size that fresh bitmap.
Backs the single-cell write in crate::Column::combine_at.
Sourcepub fn null_count(&self) -> usize
pub fn null_count(&self) -> usize
Number of missing values (dense ⇒ 0).
Sourcepub fn and(&self, other: &Validity) -> Validity
pub fn and(&self, other: &Validity) -> Validity
Combined validity of two equal-length columns: present only where both
are present — the missing-value rule for a binary op (x ∘ NA = NA).