Struct ArrayMetadataV3

Source
#[non_exhaustive]
pub struct ArrayMetadataV3 {
Show 13 fields pub zarr_format: MustBeU64<3>, pub node_type: MustBeStr<(char<monostate::::alphabet::a::{constant#0}>, char<monostate::::alphabet::r::{constant#0}>, char<monostate::::alphabet::r::{constant#0}>, char<monostate::::alphabet::a::{constant#0}>, char<monostate::::alphabet::y::{constant#0}>)>, pub shape: Vec<u64>, pub data_type: MetadataV3, pub chunk_grid: MetadataV3, pub chunk_key_encoding: MetadataV3, pub fill_value: FillValueMetadataV3, pub codecs: Vec<MetadataV3>, pub attributes: Map<String, Value>, pub storage_transformers: Vec<MetadataV3>, pub dimension_names: Option<Vec<Option<String>>>, pub extensions: Vec<MetadataV3>, pub additional_fields: BTreeMap<String, AdditionalFieldV3>,
}
Expand description

Zarr V3 array metadata.

An example JSON document for a Zarr V3 array:

{
    "zarr_format": 3,
    "node_type": "array",
    "shape": [10000, 1000],
    "dimension_names": ["rows", "columns"],
    "data_type": "float64",
    "chunk_grid": {
        "name": "regular",
        "configuration": {
            "chunk_shape": [1000, 100]
        }
    },
    "chunk_key_encoding": {
        "name": "default",
        "configuration": {
            "separator": "/"
        }
    },
    "codecs": [{
        "name": "gzip",
        "configuration": {
            "level": 1
        }
    }],
    "fill_value": "NaN",
    "attributes": {
        "foo": 42,
        "bar": "apples",
        "baz": [1, 2, 3, 4]
    }
}

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§zarr_format: MustBeU64<3>

An integer defining the version of the storage specification to which the array adheres. Must be 3.

§node_type: MustBeStr<(char<monostate::::alphabet::a::{constant#0}>, char<monostate::::alphabet::r::{constant#0}>, char<monostate::::alphabet::r::{constant#0}>, char<monostate::::alphabet::a::{constant#0}>, char<monostate::::alphabet::y::{constant#0}>)>

A string defining the type of hierarchy node element, must be array here.

§shape: Vec<u64>

An array of integers providing the length of each dimension of the Zarr array.

§data_type: MetadataV3

The data type of the Zarr array.

§chunk_grid: MetadataV3

The chunk grid of the Zarr array.

§chunk_key_encoding: MetadataV3

The mapping from chunk grid cell coordinates to keys in the underlying store.

§fill_value: FillValueMetadataV3

Provides an element value to use for uninitialised portions of the Zarr array.

Suitable values are dependent on the data type.

Boolean. The value must be a JSON boolean (false or true).

Signed integers (int{8,16,32,64}) or unsigned integers (uint{8,16,32,64}). The value must be a JSON number with no fraction or exponent part that is within the representable range of the data type.

Floating point numbers (float{16,32,64}, bfloat16).

  • A JSON number, that will be rounded to the nearest representable value.
  • A JSON string of the form:
  • "Infinity", denoting positive infinity;
  • "-Infinity", denoting negative infinity;
  • "NaN", denoting thenot-a-number (NaN) value where the sign bit is 0 (positive), the most significant bit (MSB) of the mantissa is 1, and all other bits of the mantissa are zero;
  • *"0xYYYYYYYY", specifying the byte representation of the floating point number as an unsigned integer.

Complex numbers (complex{64,128}) The value must be a two-element array, specifying the real and imaginary components respectively, where each component is specified as defined above for floating point number.

Raw data types (r<N>) An array of integers, with length equal to <N>, where each integer is in the range [0, 255].

§codecs: Vec<MetadataV3>

Specifies a list of codecs to be used for encoding and decoding chunks.

§attributes: Map<String, Value>

Optional user defined attributes.

§storage_transformers: Vec<MetadataV3>

An optional list of storage transformers.

§dimension_names: Option<Vec<Option<String>>>

An optional list of dimension names.

§extensions: Vec<MetadataV3>

Extension definitions (Zarr 3.1, ZEP0009).

§additional_fields: BTreeMap<String, AdditionalFieldV3>

Additional fields.

Implementations§

Source§

impl ArrayMetadataV3

Source

pub fn new( shape: Vec<u64>, chunk_grid: MetadataV3, data_type: MetadataV3, fill_value: FillValueMetadataV3, codecs: Vec<MetadataV3>, ) -> ArrayMetadataV3

Create new Zarr V3 array metadata.

Defaults to:

  • default chunk key encoding with the ‘/’ separator,
  • empty attributes,
  • no dimension names,
  • no storage transformers,
  • no extensions, and
  • no additional fields.
Source

pub fn to_string_pretty(&self) -> String

Serialize the metadata as a pretty-printed String of JSON.

Source

pub fn with_attributes(self, attributes: Map<String, Value>) -> ArrayMetadataV3

Set the user attributes.

Source

pub fn with_additional_fields( self, additional_fields: BTreeMap<String, AdditionalFieldV3>, ) -> ArrayMetadataV3

Set the additional fields.

Source

pub fn with_chunk_key_encoding( self, chunk_key_encoding: MetadataV3, ) -> ArrayMetadataV3

Set the chunk key encoding.

Source

pub fn with_dimension_names<I, D>( self, dimension_names: Option<I>, ) -> ArrayMetadataV3
where I: IntoIterator<Item = D>, D: IntoDimensionName,

Set the dimension names.

Source

pub fn with_storage_transformers( self, storage_transformers: Vec<MetadataV3>, ) -> ArrayMetadataV3

Set the storage transformers.

Source

pub fn with_extensions(self, extensions: Vec<MetadataV3>) -> ArrayMetadataV3

Set the extension definitions.

Trait Implementations§

Source§

impl Clone for ArrayMetadataV3

Source§

fn clone(&self) -> ArrayMetadataV3

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 Debug for ArrayMetadataV3

Source§

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

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

impl<'de> Deserialize<'de> for ArrayMetadataV3

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<ArrayMetadataV3, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ArrayMetadataV3

Source§

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

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

impl From<ArrayMetadataV3> for ArrayMetadata

Source§

fn from(value: ArrayMetadataV3) -> ArrayMetadata

Converts to this type from the input type.
Source§

impl PartialEq for ArrayMetadataV3

Source§

fn eq(&self, other: &ArrayMetadataV3) -> 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 Serialize for ArrayMetadataV3

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ArrayMetadataV3

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,