Skip to main content

OptionalDataType

Struct OptionalDataType 

Source
pub struct OptionalDataType(/* private fields */);
Expand description

The optional data type.

This wraps the inner DataType and provides methods specific to optional types, such as checking if a fill value represents null and extracting inner fill value bytes.

Use the explicit accessor methods (e.g., inner(), data_type()) to access the wrapped data type’s properties.

Implementations§

Source§

impl OptionalDataType

Source

pub fn new(inner: DataType) -> OptionalDataType

Create a new optional data type wrapper.

Source

pub fn is_fill_value_null(&self, fill_value: &FillValue) -> bool

Check if the fill value represents null (last byte is 0x00).

Source

pub fn fill_value_inner_bytes<'a>(&self, fill_value: &'a FillValue) -> &'a [u8]

Get the inner fill value bytes (without optional suffix).

For optional data types, returns all bytes except the last suffix byte.

Source

pub fn configuration(&self, version: ZarrVersion) -> Configuration

Returns the configuration for this optional data type.

Source§

impl OptionalDataType

Source

pub fn inner(&self) -> &DataType

Returns a reference to the inner data type.

Source

pub fn into_inner(self) -> DataType

Returns the inner data type, consuming self.

Source

pub fn data_type(&self) -> &DataType

The underlying inner data type.

Source

pub fn inner_size(&self) -> DataTypeSize

The size of the inner data type.

Source

pub fn is_fixed(&self) -> bool

Returns true if the inner data type is fixed size.

Source

pub fn fixed_size(&self) -> Option<usize>

Returns the fixed size of the inner data type if it’s fixed size.

Source

pub fn fill_value_from_metadata( &self, fill_value: &FillValueMetadataV3, version: ZarrVersion, ) -> Result<FillValue, DataTypeFillValueMetadataError>

Create a fill value from metadata for the inner data type.

§Errors

Returns DataTypeFillValueMetadataError if the fill value is incompatible with the inner data type.

Trait Implementations§

Source§

impl Clone for OptionalDataType

Source§

fn clone(&self) -> OptionalDataType

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl DataTypeTraits for OptionalDataType

Source§

fn configuration(&self, version: ZarrVersion) -> Configuration

The configuration of the data type.
Source§

fn size(&self) -> DataTypeSize

The size of the data type. Read more
Source§

fn fill_value( &self, fill_value_metadata: &FillValueMetadataV3, version: ZarrVersion, ) -> Result<FillValue, DataTypeFillValueMetadataError>

Create a fill value from metadata. Read more
Source§

fn metadata_fill_value( &self, fill_value: &FillValue, ) -> Result<FillValueMetadataV3, DataTypeFillValueError>

Create fill value metadata. Read more
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Returns self as Any for downcasting. Read more
Source§

fn configuration_v3(&self) -> Configuration

The Zarr V3 configuration of the data type.
Source§

fn configuration_v2(&self) -> Configuration

The Zarr V2 configuration of the data type.
Source§

fn fill_value_v2( &self, fill_value_metadata: &FillValueMetadataV3, ) -> Result<FillValue, DataTypeFillValueMetadataError>

Create a fill value from Zarr V2 metadata. Read more
Source§

fn fill_value_v3( &self, fill_value_metadata: &FillValueMetadataV3, ) -> Result<FillValue, DataTypeFillValueMetadataError>

Create a fill value from Zarr V3 metadata. Read more
Source§

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

Compare this data type with another for equality. Read more
Source§

fn compatible_element_types(&self) -> &'static [TypeId]

Returns the set of Rust element types this data type is compatible with. Read more
Source§

impl DataTypeTraitsV3 for OptionalDataType

Source§

fn create(metadata: &MetadataV3) -> Result<DataType, PluginCreateError>

Create a data type from Zarr V3 metadata. Read more
Source§

impl Debug for OptionalDataType

Source§

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

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

impl ExtensionAliases<ZarrVersion2> for OptionalDataType

Source§

fn aliases() -> RwLockReadGuard<'static, ExtensionAliasesConfig>

Get a read lock on the aliases configuration for this version.
Source§

fn aliases_mut() -> RwLockWriteGuard<'static, ExtensionAliasesConfig>

Get a write lock on the aliases configuration for this version.
Source§

fn matches_name(name: &str) -> bool

Check if the given name matches this extension’s identifier or any of its aliases for the given Zarr version. Read more
Source§

impl ExtensionAliases<ZarrVersion3> for OptionalDataType

Source§

fn aliases() -> RwLockReadGuard<'static, ExtensionAliasesConfig>

Get a read lock on the aliases configuration for this version.
Source§

fn aliases_mut() -> RwLockWriteGuard<'static, ExtensionAliasesConfig>

Get a write lock on the aliases configuration for this version.
Source§

fn matches_name(name: &str) -> bool

Check if the given name matches this extension’s identifier or any of its aliases for the given Zarr version. Read more
Source§

impl ExtensionNameStatic for OptionalDataType

Source§

const DEFAULT_NAME_FN: fn(ZarrVersion) -> Option<Cow<'static, str>>

Function pointer to get the default name for a given Zarr version. Read more
Source§

impl PartialEq for OptionalDataType

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for OptionalDataType

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ExtensionAliasesV2 for T

Source§

fn aliases_v2() -> RwLockReadGuard<'static, ExtensionAliasesConfig>

Get a read lock on the V2 aliases configuration.
Source§

fn aliases_v2_mut() -> RwLockWriteGuard<'static, ExtensionAliasesConfig>

Get a write lock on the V2 aliases configuration.
Source§

fn matches_name_v2(name: &str) -> bool

Check if the given name matches this extension for Zarr V2.
Source§

impl<T> ExtensionAliasesV3 for T

Source§

fn aliases_v3() -> RwLockReadGuard<'static, ExtensionAliasesConfig>

Get a read lock on the V3 aliases configuration.
Source§

fn aliases_v3_mut() -> RwLockWriteGuard<'static, ExtensionAliasesConfig>

Get a write lock on the V3 aliases configuration.
Source§

fn matches_name_v3(name: &str) -> bool

Check if the given name matches this extension for Zarr V3.
Source§

impl<T> ExtensionName for T

Source§

fn name(&self, version: ZarrVersion) -> Option<Cow<'static, str>>

Get the name for this extension instance for the given Zarr version. Read more
Source§

fn name_v3(&self) -> Option<Cow<'static, str>>

Get the name for this extension instance for Zarr V3. Read more
Source§

fn name_v2(&self) -> Option<Cow<'static, str>>

Get the name for this extension instance for Zarr V2. 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.