Expand description
Pure-Rust HDF5 binary format parsing and writing.
rustyhdf5-format is a zero-dependency (no C libhdf5) crate for reading and
writing HDF5 files. It supports no_std environments with the alloc crate.
§Writing files
Use file_writer::FileWriter to create HDF5 files:
use rustyhdf5_format::file_writer::{FileWriter, AttrValue};
let mut fw = FileWriter::new();
fw.create_dataset("data")
.with_f64_data(&[1.0, 2.0, 3.0])
.with_shape(&[3])
.set_attr("unit", AttrValue::String("m/s".into()));
let bytes = fw.finish().unwrap();§Reading files
Parsing follows the HDF5 object model: superblock → object header → messages.
use rustyhdf5_format::{signature, superblock, object_header, group_v2,
datatype, dataspace, data_layout, data_read, message_type::MessageType};
let file_data = std::fs::read("output.h5").unwrap();
let sig = signature::find_signature(&file_data).unwrap();
let sb = superblock::Superblock::parse(&file_data, sig).unwrap();
let addr = group_v2::resolve_path_any(&file_data, &sb, "data").unwrap();
let hdr = object_header::ObjectHeader::parse(
&file_data, addr as usize, sb.offset_size, sb.length_size).unwrap();§Features
| Feature | Default | Description |
|---|---|---|
std | yes | Standard library support |
checksum | yes | Jenkins lookup3 checksum validation |
deflate | yes | Deflate (gzip) compression via flate2 |
provenance | yes | SHINES provenance — SHA-256 hashing & verification |
Modules§
- attribute
- HDF5 Attribute message parsing (message type 0x000C).
- attribute_
info - HDF5 Attribute Info message parsing (message type 0x0015).
- btree_
v1 - HDF5 B-tree v1 parsing (type 0 for groups).
- btree_
v2 - HDF5 B-tree v2 parsing.
- checksum
- HDF5 metadata checksum: Jenkins lookup3
hashlittleand CRC32. - chunk_
cache - Chunk cache with hash-based index and LRU eviction.
- chunked_
read - Chunked dataset reading: B-tree v1 type 1 traversal and chunk assembly.
- chunked_
write - Chunked dataset writing: chunk splitting, compression, index building.
- data_
layout - HDF5 Data Layout message parsing (message type 0x0008).
- data_
read - Raw data reading and typed conversion for HDF5 datasets.
- dataspace
- HDF5 Dataspace message parsing (message type 0x0001).
- datatype
- HDF5 Datatype message parsing (message type 0x0003).
- error
- Error types for HDF5 format parsing.
- extensible_
array - HDF5 Extensible Array index parsing for chunked datasets (v4 index type 4).
- file_
writer - HDF5 file creation (write pipeline).
- filter_
pipeline - HDF5 Filter Pipeline message parsing (message type 0x000B).
- filters
- HDF5 filter implementations: deflate, shuffle, fletcher32.
- fixed_
array - HDF5 Fixed Array index parsing for chunked datasets (v4 index type 3).
- fractal_
heap - HDF5 Fractal Heap parsing for v2 group link storage.
- global_
heap - HDF5 Global Heap collection parsing.
- group_
info - HDF5 Group Info message parsing (message type 0x000A).
- group_
v1 - V1 group traversal: resolve group children and navigate paths.
- group_
v2 - V2 group traversal: resolve group children and navigate paths.
- link_
info - HDF5 Link Info message parsing (message type 0x0002).
- link_
message - HDF5 Link message parsing (message type 0x0006).
- local_
heap - HDF5 Local Heap parsing.
- message_
type - HDF5 object header message type identifiers.
- metadata_
index - Index-table + metadata-block architecture for independent parallel dataset creation.
- object_
header - HDF5 Object Header parsing (v1 and v2).
- object_
header_ writer - Object header writer for v2 format.
- provenance
- SHINES provenance: SHA-256 content hashing, provenance attributes, and data-integrity verification.
- shared_
message - HDF5 Shared Object Header Message resolution.
- signature
- HDF5 file signature (magic bytes) detection.
- superblock
- HDF5 Superblock parsing for versions 0, 1, 2, and 3.
- symbol_
table - HDF5 Symbol Table Message and Symbol Table Node (SNOD) parsing.
- type_
builders - Builder types for HDF5 datatypes, attributes, datasets, and groups.
- vl_data
- Variable-length data reading (VL strings & VL sequences).