- Support for HDF5 version 2.0.0, including:
- Version detection and conditional compilation for HDF5 2.x
- Versioned API bindings for
H5Dread_chunk2,H5Tdecode2,H5Iregister_type2 - New
H5T_COMPLEXdatatype class support in bindings - Complex number predefined types (
H5T_COMPLEX_IEEE_F32LE, etc.) - bfloat16 predefined types (
H5T_FLOAT_BFLOAT16LE,H5T_FLOAT_BFLOAT16BE) - FP8 predefined types (
H5T_FLOAT_F8E4M3,H5T_FLOAT_F8E5M2) H5Tcomplex_createfunction bindingDatatype::is_complex()method (HDF5 2.0.0+)- Comprehensive test suite for HDF5 2.0.0 features
- Support for HDF5 version 1.14.0.
- Support field renaming via
#[hdf5(rename = "new_name")]helper attribute. - Add a
ByteReaderwhich implementsstd::io::{Read, Seek}for 1Du8datasets. Usage viaDataset::as_byte_reader(). - Add
chunk_visitto visit all chunks in a dataset. - Add support for float16 values (
half::f16), enabled via "f16" feature. - Add support for complex numbers (
num_complex::Complex), enabled via "complex". - Adding feature
staticfor thehdf5crate which downloads and builds a bundled HDF5.
- The
H5Typederive macro now usesproc-macro-errorto emit error messages. - MSRV is now
1.70.0and Rust edition has now been bumped to 2021. - Types in ChunkInfo has been changed to match HDF5.
- Dependencies now uses the
dep:syntax and are only enabled through features. - Some features are made weak and will not enable e.g. static build when asking for a library which is threadsafe.
- Requesting a feature which is not compiled in the dynamic HDF5 library will now cause a compile time error.
- The bundled version of HDF5 in
hdf5-srcis now 2.0.0.
- Fixed a bug where
H5Pget_fapl_directwas only included when HDF5 was compiled with featurehave-parallelinstead ofhave-direct. - Fixed a missing symbol when building
hdf5-srcwithlibz-sys. - Fixed a bug where errors were only silenced on the main thread.
- Fixed a memory leak when opening datasets.
- Avoid creating unaligned references in
H5Typederive macro. - Applying filters without chunking will now produce an explicit error.
- Fixed a bug where chunking could not be enabled for zero-sized extents.
- Fixed library finding on Windows with MSYS2-distributed MinGW HDF5.
- Fixed a bug which made parallel builds unusable.
Release date: Nov 21, 2021.
Errornow implementsFrom<Infallible>, which allows passing convertible extents (like tuples of integers) whereimpl TryInto<Extents>is required.- Support for HDF5 versions 1.12.1 and 1.10.8.
#[derive(H5Type)]now supports structs / tuple structs withrepr(packed).#[derive(H5Type)]now supports structs / tuple structs withrepr(transparent)(the generated HDF5 type is equivalent to the type of the field and is not compound).
- Renamed
filters::gzip_available()todeflate_available()(the old name is present but marked as deprecated). - Code dependent on HDF5 version in
hdf5andhdf5-syscrates now uses features instead of cfg options:cfg(feature = "1.10.1")instead ofcfg(hdf5_1_10_1). The main initial reason for that is for HDF5 versions to show up in the official documentation on docs.rs. - Similar to the above, there's
have-direct,have-parallelandhave-threadsafefeatures that reflect the build configuration of the underlying HDF5 library.
- Fixed a bug where all blosc filter settings were discarded / zeroed out.
- Fixed errors when recovering filter pipelines from stored datasets.
- Fixed a bug where filter availability was computed incorrectly.
Release date: Oct 23, 2021.
- Complete rewrite of
DatasetBuilder; dataset creation API is now different and not backwards-compatible (however, it integrates all the new features and is more flexible and powerful). It is now possible to create and write datasets in one step. Refer to the API docs for full reference. - Added new
Extentstype matching HDF5 extents types: null (no elements), scalar, simple (fixed dimensionality); it is used to query and specify shapes of datasets. Extents objects are convertible from numbers and also tuples, slices and vectors of indices -- all of which can be used whenever passing extents is required (e.g., when creating a new dataset or an attribute). - Added new
Selectiontype with the surrounding API closely matching native HDF5 selection API. This includes 'all' selection, point-wise selection and hyperslab selection (only 'regular' hyperslabs are supported -- that is, hyperslabs that can be represented as a single multi-dimensional box some of whose dimensions may be infinite). Selection objects are convertible from integers, ranges, tuples and arrays of integers and ranges; one can also uses!macro fromndarraycrate if needed. Selections can be provided when reading and writing slices. - Support for LZF / Blosc filters has been added. These filters are enabled by
"lzf" / "blosc" cargo features and depend on
lzf-sys/blosc-srccrates respectively. Blosc filter is a meta-filter providing multi-threaded access to the best-in-class compression codecs like Zstd and LZ4 and is recommended to use as a default when compression performance is critical. - Added new
Filtertype to unify the filters API; if LZF / Blosc filters are enabled, this enum also contains the corresponding variants. It is now also possible to provide user-defined filters with custom filter IDs and configs. - Added wrappers for dataset creation property list (DCPL) API. This provides access to the properties that can be specified at dataset creation time (e.g., layout, chunking, fill values, external file linking, virtual maps, object time tracking, attribute creation order, and a few other settings).
- Virtual dataset maps (VDS API in HDF5 1.10+) are now supported.
- Added wrappers for link creation property list (LCPL) API.
- File creation property list (FCPL) API has been extended to include a few previously missing properties (object time tracking, attribute creation order and few other settings).
- Added "h5-alloc" feature to
hdf5-typescrate. It enables using the HDF5 library allocator for varlen types and dynamic values. This may be necessary on platforms where different allocators may be used in different libraries (e.g. dynamic libraries on Windows) or iflibhdf5is compiled with the memchecker option enabled. This option is force-enabled by default if using a dll version of the HDF5 library on Windows. - Added new
DynValuetype which represents a dynamic self-describing HDF5 object that also knows how to deallocate itself. It supports all the HDF5 types including compound types, strings and arrays. - Added support for attributes and a new
Attributeobject type. The attribute API uses the new dataset API with some restrictions imposed by HDF5 library (e.g. one can not perform partial IO, attributes must be read all at once). hdf5-sysnow exports new functions added in HDF5 1.10.6 and 1.10.7.- Added to
Dataset:layout: get the dataset layout.dapl,access_plist: get the dataset access plist.dcpl,create_plist: get the dataset create plist.
- Added to
Location:loc_info,loc_info_by_name: retrieve information on a location.loc_type,loc_type_by_name: retrieve location type.open_by_token: open a location by its token (physical address).
- Added to
Group:iter_visit: closure API for iterating over objects in a group.iter_visit_default: likeiter_visitbut with default iteration order.get_all_of_type: find all objects in a group of a given type.- Shortcut methods for finding all objects in a group of a given type:
datasets,groups,named_datatypes,link_external.
- Added to
Handle:id_type: get native HDF5 object type.try_borrow: instantiate a handle but don't take ownership of the object.Handlenow implementsDebug.
- Added to
ObjectClass:cast(): safe counterpart tocast_unchecked().
- Added to
Object:- Safe downcast methods:
as_file,as_group,as_datatype,as_dataspace,as_dataset,as_attr,as_location,as_container,as_plist.
- Safe downcast methods:
- Added to
FileAccessBuilder:libver_earliest,libver_v18,libver_v110,libver_latest: shortcuts for setting the minimum library version.
- Added to
FileAccess:libver: shortcut for getting the minimum library version.
- Required Rust compiler version is now
1.51. - Removed
num-integerandnum-traitsdependencies. Dataspacetype has been reworked and can be now constructed from anExtentsobject and sliced with aSelectionobject.Dataset::fill_valuenow returns an object of the newly addedDynValuetype; this object is self-describing and knows how to free itself.- Automatic chunking now uses a fill-from-back approach instead of the
previously used method which was borrowed from
h5py. - Removed the old
Filterstype (replaced byFilterthat represents a single filter). write_slice,read_slice,read_slice_1d,read_slice_2dinContainernow take any object convertible toSelection(instead ofSliceInfo).Dataset::chunkshas been renamed toDataset::chunk.- Const generics support (MSRV 1.51):
hdf5-typesnow uses const generics for array types, allowing fixed-size arrays of arbitrary sizes.Arraytrait has been removed. String types are now generic over size:FixedAscii<N>andFixedUnicode<N>. ndarraydependency has been updated to0.15.- The version of HDF5 in
hdf5-srchas been updated from 1.10.6 to 1.10.7. zlibdependency is no longer included withdefault-features.- The crate no longer calls
H5closeautomatically on program exit. - Errors are now silenced, and will not be written to stderr by default.
silence_errorsnow works globally instead of using guards.- Errors are no longer automatically expanded into error stacks when encountered. This can be still done manually (e.g. via printing the error).
- Handles to HDF5 identifiers are no longer tracked via a global registry; identifier safety is now enforced via stricter semantics of ownership.
- Handles to
Fileobjects will no longer close all objects contained in the file when dropped -- weak file close degree is now used instead. For the old behaviour seeFileCloseDegree::Strong. - HDF5 global variables no longer create a
lazy_staticper variable. - Unsafe
cast()inObjectClasshas been renamed tocast_unchecked(). - Bump
winreg(Windows only) to 0.10,pretty_assertions(dev) to 1.0. - Updated the example in the readme to showcase the new features.
- A potential memory leak of identifier handles has been identified and fixed.
- A potential race condition occurring in multi-thread library initialisation has been identified and fixed.
- Free-standing functions
get_id_type,is_valid_id,is_valid_user_idhave been removed in favor ofHandlemethods.
Release date: Jan 27, 2021.
- Slices can now be used where trait item
Dimensionis required. - Arrays of arbitrary sizes are now supported in
hdf5-types. This requires the crate featureconst_genericsand minimum Rust version of 1.51.
- Dependencies are bumped to the newest major versions;
ndarrayusers may now use both version0.13and version0.14.
- Cross-compilation of
hdf5-srcfrom Unix to Windows will now use the correct name of the static library when linking.
Release date: Aug 9, 2020.
- HDF5 C library can now be built from source and linked in statically, enabled
via
hdf5-sys/staticfeature (as of this release, the version of the bundled sources of HDF5 is 1.10.6). CMake is required for building. For further details, see the docs forhdf5-sys. - Thanks to static build option, the documentation will now be built on docs.rs; if it builds successfully, this will be the official documentation source from now on.
- Add support for HDF5 1.12 on all platforms and include it in CI.
- Switched CI from Travis/AppVeyor to GitHub Actions; for each pull request, we now run around 30 concurrent builds which provides with a much wider coverage than previously and has already revealed some issues that have been fixed. Platforms covered: macOS 10.15, Windows Server 2019, Ubuntu 16.04/18.04/20.04; HDF5 installation methods covered: conda, apt, homebrew, also official binaries on Windows. We now also test MPI versions of the library for both MPICH and OpenMPI on macOS / Linux.
- We now force the variable-length allocator that HDF5 uses when reading data
to use
libc::mallocandlibc::free, so that they can be deallocated properly byVarLenStringandVarLenArrayinhdf5-types. Previously, this could cause a rare but serious failure for Windows builds when the default allocator used for vlen types by HDF5 was not matching the libc deallocator. - Use
std::panic::catch_unwindin all cases where we use extern C callbacks, so that they are panic-safe. Reader::read_rawandReader::read_sliceshould now beDrop-safe in the event where the read operation fails and the destination type is not trivial.
Release date: Apr 12, 2020.
- Implement
DefaultforH5D_layout_t,H5D_alloc_time_t,H5T_cset_t,H5D_fill_time_t,H5D_fill_value_t(based on what their values are set to in default property lists). - Derive
DebugforErrorFrameandErrorStack. - Implement
DisplayforTypeDescriptor. - Implement
Dimensionfor[Ix],&[Ix],[Ix; N]and&[Ix; N].
h5check!,h5lock!,h5try!,h5call!andh5check()are now public.globalsmodule containing HDF5 runtime constants is now also public.- Switch to using 1.0 versions of
syn,quoteandproc-macro2(which required a bit of a rewrite ofhdf5-derive). - Bump
asciito 1.0, updatehdf5-typesto be compatible. - Bump other dependencies to their latest versions (
parking_lotto 0.10,ndarrayto 0.13,bitflagsto 1.2,lazy_staticto 1.4,libloadingto 0.6,winregto 0.7). - Remove implementations of deprecated
Error::description(). - Switch to
trybuildinstead ofcompiletest_rsfor derive-macro testing; enable full tests (including hdf5-derive) on both AppVeyor and Travis. - Update the minimum Rust version to 1.40 (due to
ndarrayandlibloading).
- Use
H5_free_memory()instead oflibc::free()to free HDF5-allocated resources if possible (1.8.13+); this fixes some deallocation errors. - Fix wrong
H5D_DONT_FILTER_PARTIAL_CHUNKSconstant value. H5Z_filter_tis changed toc_int(was wrongfully set tohid_t).
Release date: Feb 17, 2020.
- Added support for HDF5 1.10.5 with bindings for new functions.
File::access_plist()orFile::fapl()to get file access plist.File::create_plist()orFile::fcpl()to get file creation plist.- Added wrappers for dataset access H5P API in
plist::DatasetAccess. - Added
is_library_threadsafe()function. - Added
Group::member_names(). - Added
Datatype::byte_order(). - Added
Dataset::num_chunks()(1.10.5+). - Added
Dataset::chunk_info()(1.10.5+).
- Changed
Fileconstructors, getting rid of string access modes:File::open(path, "r")is nowFile::open(path)File::open(path, "r+")is nowFile::open_rw(path)File::open(path, "w")is nowFile::create(path)File::open(path, "x" | "w-")is nowFile::create_excl(path)File::open(path, "a")is nowFile::append(path)
- Also added
File::open_as(path, mode)which accepts the mode enum. - Rewritten
FileBuilder: it no longer accepts userblock, driver etc.; all of these parameters can be set in the corresponding FAPL / FCPL:FileBuilder::set_access_plist()orFileBuilder::set_fapl()to set the active file access plist to a given one.FileBuilder::access_plist()orFileBuilder::fapl()to get a mutable reference to the FAPL builder -- any parameter can then be tweaked.FileBuilder::with_access_plist()orFileBuilder::with_fapl()to get access to the FAPL builder in an inline way via a closure.- Same as the three above for
create_plist/fcpl.
- As a result, all the newly added FAPL / FCPL functionality is fully
accessible in the new
FileBuilder. Also, driver strings are gone, everything is strongly typed now. - It's no longer prohibited to set FCPL options when opening a file and not creating it -- it will simply be silently ignored (this simplifies the behavior and allows using a single file builder).
- Added an explicit
hdf5_types::string::StringErrorerror type, anderror-chaindependency has now been dropped. Erroris now convertible fromndarray::ShapeError;ResultExttrait has been removed.- Renamed
hdf5_version()tolibrary_version().
- Replaced deprecated
std::mem::uninitializedwithstd::mem::MaybeUninit. - Fixed a serde-related problem with building
hdf5-syson Windows.
Release date: Jul 14, 2019.
- Allow chunk dimensions to exceed dataset dimensions for resizable datasets.
- Default HDF5 location should now be detected automatically on Fedora Linux.
Release date: Mar 8, 2019.
- Added
Group::link_exists(). - Re-export
silence_errors()at the crate root. - Added
from_id()unsafe method at the crate root.
#[derive(H5Type)]no longer requires addinghdf5-typesas a dependency.
Release date: Mar 8, 2019.
- Added support for HDF5 1.10.
- Added Rust equivalents of HDF5 primitives: arrays, Unicode strings and ASCII
strings – all of them available in both fixed-size/variable-length flavours
(see
hdf5-typescrate for details). - Added
H5Typetrait that unifies the types that can be handled by the HDF5 library. This trait is implemented by default for all scalar types, tuples, fixed-size arrays and all types inhdf5-typesand can be used to createDatatypeobjects for known types. - Implemented
#[derive(H5Type)]proc macro that allows for seamless mapping of user-defined structs and enums to their HDF5 counterparts. - Added high-level wrappers for file-creation H5P API (
plist::FileCreate) and file-access H5P API (plist::FileAccess), covering almost the entirety of FCPL and FAPL property list functionality. - Various improvements and additions to
PropertyListtype. - Added support for file drivers: sec2/stdio/core/family/multi/split/log.
- Added support for MPIO driver (requires
H5_HAVE_PARALLELHDF5 flag and the crate has to be built with "mpio" feature enabled). - Added support for direct VFD driver (requires
H5_HAVE_DIRECTHDF5 flag). - Added some missing bindings to
hdf5-sys: driver-related FAPL bindings inh5pandh5fd(including MPIO and direct VFD drivers), MPIO bindings inh5p,h5fandh5fd. - Added core reading/writing API in
Container, with support for reading and writing scalars, 1-D/2-D/dynamic-dimensional arrays and raw slices. As a side effect, the main crate now depends onndarray.Datasetnow dereferences toContainer. - Added basic support for reading and writing dataset slices.
- When creating datasets, in-memory type layouts are normalized (converted to C representation).
- Added
packedoption toDatasetBuilderfor creating packed HDF5 layouts. - All object types now implement
Clone(shallow copy, increases refcount).
- Renamed
hdf5-rscrate tohdf5. - Renamed
libhdf5-syscrate tohdf5-sys(importable ashdf5_sys). - Renamed GitHub repository to
aldanor/hdf5-rust. - Updated the bindings and tests to the latest HDF5 versions (1.10.4 / 1.8.21).
- The build system has been reworked from the ground up:
hdf5-libcrate has been removed; all the build-time logic now resides in the build script ofhdf5-sys.- The build script now looks for
HDF5_DIRandHDF5_VERSIONenv vars. pkg-configis now only launched on Linux.- macOS: the build script detects Homebrew installations (both 1.8 and 1.10).
- Windows: we now scan the registry to detect official system-wide installs.
HDF5_DIRcan be now pointed to a conda env for dynamic linking.- A few definitions from
H5pubconf.hare now exposed as cfg definitions, likeh5_have_parallel,h5_have_threadsafeandh5_have_direct(this requires locating the include folder and parsing the header at build time).
- Various cleanups in
hdf5-sys: implementedDefaultandClonewhere applicable, moved a few types and methods to matching parent modules. - Major refactor: trait-based type hierarchy has been replaced with a
Deref-based hierarchy instead (53eff4f).IDandFromIDtraits have been removed. Traits likeLocation,Objectand a few others have been replaced with real types (wrappers around HDF5 handles, same as the concrete types likeFile). Subtypes then dereference into parent types, so the user can call methods of the parent type without having to import any traits into scope (for instance,Filedereferences intoGroup, which dereferences intoLocation, which dereferences intoObject). - Dataspaces and property lists can now be properly copied via
.copy()method (instead of.clone()which now yields a shallow copy increasing refcount).
hbool_tis now mapped to unsigned integer of proper size (either 1 byte or 4 bytes), depending on how the HDF5 library was built and on which platform.- Added missing bindings for previous versions (mostly in
h5pandh5fd). - Querying the HDF5 error stack is now thread-safe.
- Error silencing (
silence_errors()) is now thread-safe. - Fixed wrong bindings for
H5AC_cache_config_t.
- Removed
hdf5-libcrate (merged it intohdf5-sys, see above). - Removed
remutexcrate, using locking primitives fromparking_lotcrate. Containertrait has been removed in favor ofGrouptype.
- The version number jump is due to renaming crates
hdf5-rsandlibhdf5-systohdf5andhdf5-sys, respectively. Since there were already published crates with those names and the crates registry is meant to be immutable even if the crates are yanked, we had to bump the version so that it shadows all the older versions.
Release date: Jul 29, 2015.
- Full support of
msvctarget on Windows. CI tests on AppVeyor now use official releases of HDF5 binaries (1.8.16, VS2015, x86_x64). Thegnutarget are still unofficially supported but won't be tested. - If
HDF5_LIBDIRis not specified when building on Windows andPATHcontains what looks like thebinfolder of HDF5 installation, the library directory will be inferred automatically. The official HDF5 installers add thebinfolder to user path, so the official MSVC releases should just work out of the box without having to set any environment variables. - The library is now split into three crates:
hdf5-lib(requests linkage to HDF5),hdf5-sys(contains bindings, requireshdf5-libat build time in order to conditionally enable or disable certain HDF5 functionality), andhdf5(the user-facing crate, requires both lower-level crates at build time). - Added
hdf5::hdf5_versionfunction. - The minimum required version of the HDF5 library is now 1.8.4.
- Both
hdf5-sysandhdf5crates can now use version attributes at compile time to enable/disable/change functionality. All functions and definitions that appeared in HDF5 versions past 1.8.4 are now conditionally enabled inhdf5-sys. - Added bindings for HDF5 functions that were added in 1.8.15 and 1.8.16.
- Static global variables in HDF5 (H5E, H5P, H5T) are now linked based on HDF5
version and not the target platform (
_ID_gvariables were introduced in 1.8.14). Whenmsvctarget is used, dllimport stub prefixes are also accounted for. Constants exposed byhdf5-sysare now of reference type and need to be dereferenced (formsvc, they have to be dereferenced twice).
- API simplification: many methods previously expecting
Into<String>inputs now just take&str. util::to_cstringnow takesBorrow<str>instead ofInto<String>to avoid unnecessary allocations, and the return value is now wrapped inResultso that interior null bytes in input strings trigger an error.
- Fixed dangling pointer problems when strings were passed as pointers to the C API.
- Fixed target path not being passed correctly in
Container::link_soft.
Release date: Jul 27, 2015.
Initial public version.