Skip to main content

Crate hdf5_writer

Crate hdf5_writer 

Source
Expand description

Pure-Rust HDF5 writer.

Build a file from DatasetBuilders and AttributeBuilders with Hdf5Builder, turn it into an Hdf5WritePlan, and serialize it with Hdf5Writer (a seekable sink) or Hdf5WritePlan::encode (bytes):

use std::io::Cursor;
use hdf5_writer::{DatasetBuilder, Hdf5Builder, Hdf5Writer, WriteOptions};

let plan = Hdf5Builder::new()
    .dataset(DatasetBuilder::typed_data("grid", vec![2, 3], &[0_i32, 1, 2, 3, 4, 5]).unwrap())
    .into_plan()
    .unwrap();
let bytes = Hdf5Writer::new(Cursor::new(Vec::new()), WriteOptions::default())
    .finish(plan)
    .unwrap()
    .into_inner();
assert_eq!(&bytes[..8], b"\x89HDF\r\n\x1a\n");

Supported: superblock v2; contiguous, compact, and chunked layouts (implicit, single-chunk, fixed-array, and version-2 B-tree indices, the last for unlimited maximum dimensions); groups; attributes; the deflate, shuffle, and fletcher32 filters; and fixed-point, floating-point, string (fixed and variable-length), reference, variable-length, bitfield, opaque, compound, enum, and array datatypes. Output is validated against libhdf5.

Structs§

AttributeBuilder
Attribute definition used by HDF5 object headers. Builds a single HDF5 attribute attached to a dataset, group, or the file root. Supports scalars, vectors, fixed and variable-length strings, object references, and reference lists.
CompoundField
A field within a compound datatype.
DatasetBuilder
Dataset definition used by the write planner. Builds a single HDF5 dataset: its name/path, datatype, shape, layout (contiguous, compact, or chunked), optional max shape, filters, fill value, data, and attributes.
DataspaceMessage
Parsed dataspace message.
EnumMember
A member of an enumeration.
FillValueMessage
Parsed fill value message.
FilterDescription
A single filter in a filter pipeline.
FilterPipelineMessage
Parsed filter pipeline message.
GroupAttributeBuilder
Attribute attached to an HDF5 group addressed by relative path.
Hdf5Builder
Root HDF5 file builder. Accumulates datasets, root attributes, and group attributes, then produces a validated Hdf5WritePlan via Hdf5Builder::into_plan.
Hdf5WritePlan
Validated HDF5 write plan. A validated set of datasets and attributes ready to be serialized by Hdf5Writer or Hdf5WritePlan::encode.
Hdf5Writer
Writes an Hdf5WritePlan to a seekable sink. Use Hdf5WritePlan::encode when the sink is a plain Write.
WriteOptions
Configuration for HDF5 writes.

Enums§

ByteOrder
Byte order for numeric data.
ChunkIndexing
Chunk indexing method for v4/v5 layout messages.
DataLayout
Raw data storage layout for a dataset.
DataspaceType
HDF5 dataspace kind.
Datatype
Describes the element type of a dataset or attribute.
Error
HDF5 writer errors.
FillTime
When to write the fill value.
Hdf5Variant
HDF5 file variant emitted by the writer.
PlannedLayout
ReferenceType
HDF5 reference type.
StringEncoding
String character encoding.
StringPadding
String padding type.
StringSize
How a string’s length is determined.
VarLenKind
HDF5 variable-length datatype flavor.

Constants§

FILTER_DEFLATE
Standard HDF5 filter IDs.
FILTER_FLETCHER32
FILTER_LZ4
FILTER_NBIT
FILTER_SCALEOFFSET
FILTER_SHUFFLE
FILTER_SZIP
UNLIMITED
Unlimited dimension sentinel value.

Traits§

H5WriteElement
Primitive element types that can be encoded into contiguous HDF5 raw data.
H5WriteType
Trait for Rust types that can describe their HDF5 on-disk datatype.

Functions§

fletcher32
Fletcher-32 checksum used by the HDF5 filter pipeline.
jenkins_lookup3
Jenkins lookup3 hashlittle2 used by HDF5 metadata checksums.

Type Aliases§

Result