Skip to main content

Validity

Struct Validity 

Source
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

Source

pub fn dense() -> Validity

A fully-present (dense) validity — no allocation.

Source

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.

Source

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.

Source

pub fn is_valid(&self, i: usize) -> bool

Whether element i is present. Dense ⇒ always true. i in bounds.

Source

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.

Source

pub fn has_nulls(&self) -> bool

Whether any value is missing (cheap: dense ⇒ false).

Source

pub fn null_count(&self) -> usize

Number of missing values (dense ⇒ 0).

Source

pub fn bitmap(&self) -> Option<&Bitmap>

Borrow the backing bitmap, if any (None when dense).

Source

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).

Source

pub fn take(&self, idx: &[usize]) -> Validity

Gather present-flags at idx (fancy indexing / dropna). Dense stays dense.

Source

pub fn slice(&self, start: usize, end: usize) -> Validity

Present-flags over [start, end) (slicing). Dense stays dense.

Trait Implementations§

Source§

impl Clone for Validity

Source§

fn clone(&self) -> Validity

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Validity

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Validity

Source§

fn default() -> Validity

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Validity

Source§

fn eq(&self, other: &Self) -> bool

Dense compares equal to an all-present bitmap (the constructors keep Some non-trivial, so in practice this reduces to comparing patterns).

1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.