pub struct DataspaceMessage {
pub class: DataspaceClass,
pub dims: Vec<u64>,
pub max_dims: Option<Vec<u64>>,
}Expand description
Dataspace message payload.
Fields§
§class: DataspaceClassWhich 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
impl DataspaceMessage
Sourcepub fn null() -> Self
pub fn null() -> Self
The NULL dataspace: no elements at all. Unlike scalar,
a dataset with this dataspace holds zero bytes of data.
Sourcepub fn simple(dims: &[u64]) -> Self
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).
Sourcepub fn unlimited(current: &[u64]) -> Self
pub fn unlimited(current: &[u64]) -> Self
A simple dataspace where every dimension is unlimited.
Sourcepub fn element_count(&self) -> Option<u64>
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.
pub fn encode(&self, ctx: &FormatContext) -> Vec<u8> ⓘ
Sourcepub fn encode_for(&self, ctx: &FormatContext, format: ObjectFormat) -> Vec<u8> ⓘ
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.