pub struct ArrayBytesOptional<'a> { /* private fields */ }Expand description
Optional array bytes composed of data and a validity mask.
The mask is 1 byte per element where 0 = invalid/missing, non-zero = valid/present. The mask length is validated at construction to ensure it matches the number of elements.
§Equality Semantics
Two ArrayBytesOptional values are considered equal if:
- Their masks are equal
- Their valid (non-null) elements are equal
Invalid (null) element bytes are not compared, since they may differ after round-trip encoding/decoding (e.g., fill value vs original bytes).
Implementations§
Source§impl<'a> ArrayBytesOptional<'a>
impl<'a> ArrayBytesOptional<'a>
Sourcepub fn new(
data: impl Into<Box<ArrayBytes<'a>>>,
mask: impl Into<Cow<'a, [u8]>>,
) -> ArrayBytesOptional<'a>
pub fn new( data: impl Into<Box<ArrayBytes<'a>>>, mask: impl Into<Cow<'a, [u8]>>, ) -> ArrayBytesOptional<'a>
Create a new ArrayBytesOptional with validation.
Sourcepub fn data(&self) -> &ArrayBytes<'a>
pub fn data(&self) -> &ArrayBytes<'a>
Get the underlying data.
Sourcepub fn num_elements(&self) -> usize
pub fn num_elements(&self) -> usize
Get the number of elements.
Sourcepub fn into_parts(self) -> (Box<ArrayBytes<'a>>, Cow<'a, [u8]>)
pub fn into_parts(self) -> (Box<ArrayBytes<'a>>, Cow<'a, [u8]>)
Consume self and return the data and mask.
Sourcepub fn into_owned(self) -> ArrayBytesOptional<'static>
pub fn into_owned(self) -> ArrayBytesOptional<'static>
Convert into owned ArrayBytesOptional<'static>.
Trait Implementations§
Source§impl<'a> Clone for ArrayBytesOptional<'a>
impl<'a> Clone for ArrayBytesOptional<'a>
Source§fn clone(&self) -> ArrayBytesOptional<'a>
fn clone(&self) -> ArrayBytesOptional<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for ArrayBytesOptional<'a>
impl<'a> Debug for ArrayBytesOptional<'a>
Source§impl<'a> From<ArrayBytesOptional<'a>> for ArrayBytes<'a>
impl<'a> From<ArrayBytesOptional<'a>> for ArrayBytes<'a>
Source§fn from(value: ArrayBytesOptional<'a>) -> ArrayBytes<'a>
fn from(value: ArrayBytesOptional<'a>) -> ArrayBytes<'a>
Converts to this type from the input type.
Source§impl PartialEq for ArrayBytesOptional<'_>
impl PartialEq for ArrayBytesOptional<'_>
impl Eq for ArrayBytesOptional<'_>
Auto Trait Implementations§
impl<'a> Freeze for ArrayBytesOptional<'a>
impl<'a> Send for ArrayBytesOptional<'a>
impl<'a> Sync for ArrayBytesOptional<'a>
impl<'a> RefUnwindSafe for ArrayBytesOptional<'a>
impl<'a> Unpin for ArrayBytesOptional<'a>
impl<'a> UnsafeUnpin for ArrayBytesOptional<'a>
impl<'a> UnwindSafe for ArrayBytesOptional<'a>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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>
Converts
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>
Converts
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