#[non_exhaustive]pub enum Validity<'a> {
None,
Bitmap {
bytes: &'a [u8],
row_count: usize,
},
}Expand description
Per-row null information.
Validity::None means “no nulls for this column”; the column carries no
bitmap on the wire and is_null always returns false.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Implementations§
Source§impl<'a> Validity<'a>
impl<'a> Validity<'a>
Sourcepub fn from_bitmap(bytes: &'a [u8], row_count: usize) -> Result<Self>
pub fn from_bitmap(bytes: &'a [u8], row_count: usize) -> Result<Self>
Construct a bitmap-backed validity view.
Returns Err(InvalidApiCall) if bytes.len() < row_count.div_ceil(8)
— a too-short bitmap would otherwise cause Self::is_null to silently
report null rows as non-null (the bytes beyond the buffer end are
indistinguishable from “this row’s bit is 0”). The decoder always
sizes the bitmap exactly to row_count.div_ceil(8)
(see decode_validity), so the error is unreachable from
crate-internal callers; the check exists so external callers can’t
build a corrupt view and have it silently mis-report NULL rows.
pub fn has_nulls(&self) -> bool
Sourcepub fn is_null(&self, row: usize) -> bool
pub fn is_null(&self, row: usize) -> bool
true if row is null. Out-of-range rows return false (matches
the column accessors’ “row was never written” treatment).
Bounds-checked: a Validity::Bitmap constructed
directly (bypassing from_bitmap) with a
too-short bitmap reports false for the missing tail rather
than panicking. Constructor-validated values never trip the
fallback.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Validity<'a>
impl<'a> RefUnwindSafe for Validity<'a>
impl<'a> Send for Validity<'a>
impl<'a> Sync for Validity<'a>
impl<'a> Unpin for Validity<'a>
impl<'a> UnsafeUnpin for Validity<'a>
impl<'a> UnwindSafe for Validity<'a>
Blanket Implementations§
impl<T> Allocation for T
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more