pub struct FillValue(/* private fields */);Expand description
A fill value.
Provides an element value to use for uninitialised portions of the Zarr array.
For optional data types, the fill value includes an extra trailing byte:
0x00suffix indicates null/missing0x01suffix indicates non-null (inner bytes precede the suffix)
For nested optional types, each nesting level adds its own suffix byte.
Implementations§
Source§impl FillValue
impl FillValue
Sourcepub fn new_optional_null() -> Self
pub fn new_optional_null() -> Self
Create a null optional fill value.
Returns a fill value with a single 0x00 byte indicating null.
Can be chained with into_optional to create nested optional fill values.
§Examples
// Null fill value for Option<T>
let null_fill = FillValue::new_optional_null();
assert_eq!(null_fill.as_ne_bytes(), &[0]);
// Some(None) fill value for Option<Option<T>>
let some_null = FillValue::new_optional_null().into_optional();
assert_eq!(some_null.as_ne_bytes(), &[0, 1]);Sourcepub fn as_ne_bytes(&self) -> &[u8] ⓘ
pub fn as_ne_bytes(&self) -> &[u8] ⓘ
Return the byte representation of the fill value.
Sourcepub fn equals_all(&self, bytes: &[u8]) -> bool
pub fn equals_all(&self, bytes: &[u8]) -> bool
Check if the bytes are equal to a sequence of the fill value.
Sourcepub fn into_optional(self) -> Self
pub fn into_optional(self) -> Self
Wrap this fill value as a non-null optional fill value.
Appends a 0x01 suffix byte indicating the value is non-null.
Can be chained to create nested optional fill values.
§Examples
// Single level optional (Some(u8))
let opt_fill = FillValue::from(42u8).into_optional();
assert_eq!(opt_fill.as_ne_bytes(), &[42, 1]);
// Double level optional (Some(Some(u8)))
let nested = FillValue::from(42u8).into_optional().into_optional();
assert_eq!(nested.as_ne_bytes(), &[42, 1, 1]);Trait Implementations§
impl Eq for FillValue
impl StructuralPartialEq for FillValue
Auto Trait Implementations§
impl Freeze for FillValue
impl Send for FillValue
impl Sync for FillValue
impl RefUnwindSafe for FillValue
impl Unpin for FillValue
impl UnwindSafe for FillValue
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§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.