Skip to main content

DataspaceMessage

Struct DataspaceMessage 

Source
pub struct DataspaceMessage {
    pub class: DataspaceClass,
    pub dims: Vec<u64>,
    pub max_dims: Option<Vec<u64>>,
}
Expand description

Dataspace message payload.

Fields§

§class: DataspaceClass

Which dataspace class this message describes.

§dims: Vec<u64>

Current dimension sizes. Empty for Scalar and Null.

§max_dims: Option<Vec<u64>>

Maximum dimension sizes; an entry of u64::MAX means unlimited.

None is upstream’s H5S_extent_t.max == NULL: the extent carries no maximum array at all, which is a different thing from a maximum that happens to equal the current dimensions. Only decoding a message with H5S_VALID_MAX clear produces it (H5Osdspace.c:188-194) — every extent the API builds is given one (H5S.c:1293-1299) — and it survives being rewritten, because H5S_read and H5S_write decode and re-encode the one extent (H5S.c:1100, H5S.c:1039) and the encoder raises the flag only for a non-null array (H5Osdspace.c:271-272).

Upstream reads the absent array as the current dimensions wherever a bound is reported (H5S_extent_get_dims, H5S.c:968-973), which is what the crate’s consumers do too; H5S_set_extent is the exception that treats it as no bound at all (H5S.c:1777).

Implementations§

Source§

impl DataspaceMessage

Source

pub fn scalar() -> Self

A scalar dataspace (rank 0, no max dims).

Source

pub fn null() -> Self

The NULL dataspace: no elements at all. Unlike scalar, a dataset with this dataspace holds zero bytes of data.

Source

pub fn simple(dims: &[u64]) -> Self

A simple dataspace with fixed dimensions (max == current). An empty dims yields a scalar dataspace, matching how upstream never emits a Simple-class dataspace at rank 0.

The maximum is filled in here, not at encode time, because that is where upstream fills it in: H5S_set_extent_simple allocates extent.max for every simple extent and copies the current dimensions into it when the caller named no maximum (H5S.c:1293-1299).

Source

pub fn unlimited(current: &[u64]) -> Self

A simple dataspace where every dimension is unlimited.

Source

pub fn is_null(&self) -> bool

Whether this is the NULL dataspace (no elements at all).

Source

pub fn element_count(&self) -> Option<u64>

The number of elements in the extent (H5S_GET_EXTENT_NPOINTS): none for a null dataspace, one for a scalar, the product of the dimensions otherwise. None when that product does not fit in a u64.

Source

pub fn encode(&self, ctx: &FormatContext) -> Vec<u8> ⓘ

Source

pub fn encode_for(&self, ctx: &FormatContext, format: ObjectFormat) -> Vec<u8> ⓘ

Encode for a file of the given object format.

A version-1 dataspace differs only in its prefix: no type byte, and five reserved bytes where version 2 has one, so the header is 8 bytes rather than 4. The dimensions that follow are identical.

Source

pub fn decode(buf: &[u8], ctx: &FormatContext) -> FormatResult<(Self, usize)>

Trait Implementations§

Source§

impl Clone for DataspaceMessage

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DataspaceMessage

Source§

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

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

impl PartialEq for DataspaceMessage

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DataspaceMessage

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, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.