Skip to main content

Validity

Enum Validity 

Source
pub enum Validity {
    AllValid,
    AllInvalid,
    Mask(Bitmap),
}
Expand description

Which values in a vector are valid.

Variants§

§

AllValid

Nothing is null. No mask is stored and the kernels that read this take the fast path.

§

AllInvalid

Everything is null. Most operators can answer without looking at the data at all.

§

Mask(Bitmap)

Some of each, one bit per value, set meaning valid.

Implementations§

Source§

impl Validity

Source

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

Whether the value at index is not null.

Out of range reads report invalid rather than panicking, because this is called from kernels that are allowed to read past the end of a partially filled vector.

Source

pub fn has_nulls(&self, len: usize) -> bool

Whether any value in the first len is null.

Source

pub fn count_valid(&self, len: usize) -> usize

How many of the first len values are not null.

Source

pub fn normalize(self, len: usize) -> Self

Collapses a mask that turned out to be uniform back to one of the flag cases.

Worth doing at the end of any operation that builds a mask, because every kernel downstream then gets to take the branch it wants rather than walking a bitmap to find out what it already could have been told.

Source

pub fn with_null(self, index: usize, len: usize) -> Self

The validity of a vector where index has just been made null.

Takes and returns by value because setting a null on an AllValid vector has to materialize a mask, and hiding that behind &mut self hides an allocation.

Source

pub fn from_iter(len: usize, valid: impl Fn(usize) -> bool) -> Self

Validity built from a per-value predicate, normalized.

Source

pub fn and(&self, other: &Self, len: usize) -> Self

The validity of a value that is valid in both inputs, which is what almost every binary operator wants and is worth having in one place.

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 Eq for Validity

Source§

impl PartialEq for Validity

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Validity

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.