pub struct ValidityMask { /* private fields */ }Implementations§
Source§impl ValidityMask
impl ValidityMask
pub fn from_values(values: &[Scalar]) -> Self
Sourcepub fn from_f64(data: &[f64]) -> Self
pub fn from_f64(data: &[f64]) -> Self
Build a validity mask from a contiguous f64 buffer, marking NaN
positions invalid. pandas treats float NaN as missing, so this mirrors
what from_values would produce for the equivalent Scalar::Float64
values (Scalar::is_missing is true for NaN). See
Column::from_f64_values.
pub fn all_valid(len: usize) -> Self
pub fn all_invalid(len: usize) -> Self
pub fn get(&self, idx: usize) -> bool
Sourcepub fn packed_words(&self) -> Option<&[u64]>
pub fn packed_words(&self) -> Option<&[u64]>
The packed words, when this mask is PLAIN word-backed — neither the all-valid sentinel nor range-encoded.
Self::get re-decides the mask’s SHAPE on every call: a bounds check,
an all-valid-sentinel test (three loads), a range-encoding test that can
binary-search, and only then the word lookup. All of that is
loop-invariant, so a gather calling get per row pays it per row —
~1M times for a 100k x 10 frame. A caller that hoists this out of its
element loop can do the bit test inline as
(words[i / 64] >> (i % 64)) & 1, which is exactly the branch get
would have reached.
Callers must still satisfy get’s bounds rule themselves: this is only
equivalent for indices below Self::len.
pub fn set(&mut self, idx: usize, value: bool)
pub fn count_valid(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn and_mask(&self, other: &Self) -> Self
pub fn or_mask(&self, other: &Self) -> Self
pub fn not_mask(&self) -> Self
Sourcepub fn bits(&self) -> impl Iterator<Item = bool> + '_
pub fn bits(&self) -> impl Iterator<Item = bool> + '_
Returns an iterator yielding bool values, compatible with the previous
&[bool] API. Materializes from the packed representation.
Sourcepub fn count_invalid(&self) -> usize
pub fn count_invalid(&self) -> usize
Number of invalid (cleared) positions.
Sourcepub fn xor_mask(&self, other: &Self) -> Self
pub fn xor_mask(&self, other: &Self) -> Self
Bitwise XOR (symmetric difference) with another mask.
Produced length is min(self.len, other.len).
Sourcepub fn slice(&self, start: usize, len: usize) -> Self
pub fn slice(&self, start: usize, len: usize) -> Self
Extract a contiguous sub-range as a new mask.
start..start+len is clamped to the available tail — callers
don’t need to pre-validate against self.len.
Sourcepub fn first_valid(&self) -> Option<usize>
pub fn first_valid(&self) -> Option<usize>
Position of the first valid bit.
Sourcepub fn last_valid(&self) -> Option<usize>
pub fn last_valid(&self) -> Option<usize>
Position of the last valid bit.
Trait Implementations§
Source§impl Clone for ValidityMask
impl Clone for ValidityMask
Source§fn clone(&self) -> ValidityMask
fn clone(&self) -> ValidityMask
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more