Skip to content

Commit

Permalink
Merge branch 'aldanor:master' into add-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rytheo authored Jan 31, 2024
2 parents e3fd8c6 + 0299592 commit 29df194
Show file tree
Hide file tree
Showing 23 changed files with 180 additions and 99 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ jobs:
with: {submodules: true}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with: {toolchain: 1.64}
with: {toolchain: "1.70"}
- name: Build and test all crates
run:
cargo test --workspace -vv --features=hdf5-sys/static,hdf5-sys/zlib --exclude=hdf5-derive
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
### Changed

- The `H5Type` derive macro now uses `proc-macro-error` to emit error messages.
- MSRV is now `1.64.0` and Rust edition has now been bumped to 2021.
- MSRV is now `1.70.0` and 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
Expand All @@ -35,6 +35,7 @@
- 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.

## 0.8.1

Expand Down
2 changes: 1 addition & 1 deletion hdf5-sys/src/h5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ extern "C" {
}

#[cfg(feature = "1.14.0")]
type H5_atclose_func_t = Option<extern "C" fn(ctx: *mut c_void)>;
type H5_atclose_func_t = Option<unsafe extern "C" fn(ctx: *mut c_void)>;

#[cfg(feature = "1.14.0")]
extern "C" {
Expand Down
4 changes: 2 additions & 2 deletions hdf5-sys/src/h5a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ impl Default for H5A_info_t {

#[deprecated(note = "deprecated in HDF5 1.8.0, use H5A_operator2_t")]
pub type H5A_operator1_t = Option<
extern "C" fn(
unsafe extern "C" fn(
location_id: hid_t,
attr_name: *const c_char,
operator_data: *mut c_void,
) -> herr_t,
>;

pub type H5A_operator2_t = Option<
extern "C" fn(
unsafe extern "C" fn(
location_id: hid_t,
attr_name: *const c_char,
ainfo: *const H5A_info_t,
Expand Down
8 changes: 4 additions & 4 deletions hdf5-sys/src/h5d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub enum H5D_mpio_no_collective_cause_t {
}

pub type H5D_operator_t = Option<
extern "C" fn(
unsafe extern "C" fn(
elem: *mut c_void,
type_id: hid_t,
ndim: c_uint,
Expand All @@ -136,15 +136,15 @@ pub type H5D_operator_t = Option<

#[cfg(feature = "1.8.11")]
pub type H5D_scatter_func_t = Option<
extern "C" fn(
unsafe extern "C" fn(
src_buf: *mut *const c_void,
src_buf_bytes_used: *mut size_t,
op_data: *mut c_void,
) -> herr_t,
>;
#[cfg(feature = "1.8.11")]
pub type H5D_gather_func_t = Option<
extern "C" fn(
unsafe extern "C" fn(
dst_buf: *const c_void,
dst_buf_bytes_used: size_t,
op_data: *mut c_void,
Expand Down Expand Up @@ -289,7 +289,7 @@ extern "C" {

#[cfg(feature = "1.14.0")]
pub type H5D_chunk_iter_op_t = Option<
extern "C" fn(
unsafe extern "C" fn(
offset: *const hsize_t,
filter_mask: c_uint,
addr: haddr_t,
Expand Down
4 changes: 2 additions & 2 deletions hdf5-sys/src/h5es.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub enum H5ES_status_t {
}

pub type H5ES_event_complete_func_t = Option<
extern "C" fn(
unsafe extern "C" fn(
op_info: *mut H5ES_op_info_t,
status: H5ES_status_t,
err_stack: hid_t,
Expand All @@ -54,7 +54,7 @@ pub type H5ES_event_complete_func_t = Option<
>;

pub type H5ES_event_insert_func_t =
Option<extern "C" fn(op_info: *const H5ES_op_info_t, ctx: *mut c_void) -> c_int>;
Option<unsafe extern "C" fn(op_info: *const H5ES_op_info_t, ctx: *mut c_void) -> c_int>;

extern "C" {
pub fn H5ESinsert_request(es_id: hid_t, connector_id: hid_t, request: *mut c_void) -> herr_t;
Expand Down
51 changes: 27 additions & 24 deletions hdf5-sys/src/h5fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,31 +132,33 @@ pub struct H5FD_class_t {
pub fc_degree: H5F_close_degree_t,
#[cfg(feature = "1.14.0")]
pub terminate: Option<extern "C" fn() -> herr_t>,
pub sb_size: Option<extern "C" fn(file: *mut H5FD_t) -> hsize_t>,
pub sb_encode:
Option<extern "C" fn(file: *mut H5FD_t, name: *mut c_char, p: *mut c_uchar) -> herr_t>,
pub sb_decode:
Option<extern "C" fn(f: *mut H5FD_t, name: *const c_char, p: *const c_uchar) -> herr_t>,
pub sb_size: Option<unsafe extern "C" fn(file: *mut H5FD_t) -> hsize_t>,
pub sb_encode: Option<
unsafe extern "C" fn(file: *mut H5FD_t, name: *mut c_char, p: *mut c_uchar) -> herr_t,
>,
pub sb_decode: Option<
unsafe extern "C" fn(f: *mut H5FD_t, name: *const c_char, p: *const c_uchar) -> herr_t,
>,
pub fapl_size: size_t,
pub fapl_get: Option<extern "C" fn(file: *mut H5FD_t) -> *mut c_void>,
pub fapl_copy: Option<extern "C" fn(fapl: *const c_void) -> *mut c_void>,
pub fapl_free: Option<extern "C" fn(fapl: *mut c_void) -> herr_t>,
pub fapl_get: Option<unsafe extern "C" fn(file: *mut H5FD_t) -> *mut c_void>,
pub fapl_copy: Option<unsafe extern "C" fn(fapl: *const c_void) -> *mut c_void>,
pub fapl_free: Option<unsafe extern "C" fn(fapl: *mut c_void) -> herr_t>,
pub dxpl_size: size_t,
pub dxpl_copy: Option<extern "C" fn(dxpl: *const c_void) -> *mut c_void>,
pub dxpl_free: Option<extern "C" fn(dxpl: *mut c_void) -> herr_t>,
pub dxpl_copy: Option<unsafe extern "C" fn(dxpl: *const c_void) -> *mut c_void>,
pub dxpl_free: Option<unsafe extern "C" fn(dxpl: *mut c_void) -> herr_t>,
pub open: Option<
extern "C" fn(
unsafe extern "C" fn(
name: *const c_char,
flags: c_uint,
fapl: hid_t,
maxaddr: haddr_t,
) -> *mut H5FD_t,
>,
pub close: Option<extern "C" fn(file: *mut H5FD_t) -> herr_t>,
pub cmp: Option<extern "C" fn(f1: *const H5FD_t, f2: *const H5FD_t) -> c_int>,
pub query: Option<extern "C" fn(f1: *const H5FD_t, flags: *mut c_ulong) -> herr_t>,
pub close: Option<unsafe extern "C" fn(file: *mut H5FD_t) -> herr_t>,
pub cmp: Option<unsafe extern "C" fn(f1: *const H5FD_t, f2: *const H5FD_t) -> c_int>,
pub query: Option<unsafe extern "C" fn(f1: *const H5FD_t, flags: *mut c_ulong) -> herr_t>,
pub get_type_map:
Option<extern "C" fn(file: *const H5FD_t, type_map: *mut H5FD_mem_t) -> herr_t>,
Option<unsafe extern "C" fn(file: *const H5FD_t, type_map: *mut H5FD_mem_t) -> herr_t>,
pub alloc: Option<
extern "C" fn(
file: *mut H5FD_t,
Expand All @@ -174,10 +176,10 @@ pub struct H5FD_class_t {
size: hsize_t,
) -> herr_t,
>,
pub get_eoa: Option<extern "C" fn(file: *const H5FD_t, type_: H5FD_mem_t) -> haddr_t>,
pub get_eoa: Option<unsafe extern "C" fn(file: *const H5FD_t, type_: H5FD_mem_t) -> haddr_t>,
pub set_eoa:
Option<extern "C" fn(file: *mut H5FD_t, type_: H5FD_mem_t, addr: haddr_t) -> herr_t>,
pub get_eof: Option<extern "C" fn(file: *const H5FD_t) -> haddr_t>,
Option<unsafe extern "C" fn(file: *mut H5FD_t, type_: H5FD_mem_t, addr: haddr_t) -> herr_t>,
pub get_eof: Option<unsafe extern "C" fn(file: *const H5FD_t) -> haddr_t>,
pub get_handle: Option<
extern "C" fn(file: *mut H5FD_t, fapl: hid_t, file_handle: *mut *mut c_void) -> herr_t,
>,
Expand All @@ -201,9 +203,10 @@ pub struct H5FD_class_t {
buffer: *const c_void,
) -> herr_t,
>,
pub flush: Option<extern "C" fn(file: *mut H5FD_t, dxpl_id: hid_t, closing: c_uint) -> herr_t>,
pub flush:
Option<unsafe extern "C" fn(file: *mut H5FD_t, dxpl_id: hid_t, closing: c_uint) -> herr_t>,
pub truncate:
Option<extern "C" fn(file: *mut H5FD_t, dxpl_id: hid_t, closing: hbool_t) -> herr_t>,
Option<unsafe extern "C" fn(file: *mut H5FD_t, dxpl_id: hid_t, closing: hbool_t) -> herr_t>,
pub lock: Option<
extern "C" fn(
file: *mut H5FD_t,
Expand All @@ -213,9 +216,9 @@ pub struct H5FD_class_t {
) -> herr_t,
>,
pub unlock:
Option<extern "C" fn(file: *mut H5FD_t, oid: *mut c_uchar, last: hbool_t) -> herr_t>,
Option<unsafe extern "C" fn(file: *mut H5FD_t, oid: *mut c_uchar, last: hbool_t) -> herr_t>,
#[cfg(feature = "1.14.0")]
pub del: Option<extern "C" fn(name: *const c_char, fapl: hid_t) -> herr_t>,
pub del: Option<unsafe extern "C" fn(name: *const c_char, fapl: hid_t) -> herr_t>,
#[cfg(feature = "1.14.0")]
pub ctl: Option<
extern "C" fn(
Expand Down Expand Up @@ -316,8 +319,8 @@ pub struct H5FD_file_image_callbacks_t {
udata: *mut c_void,
) -> herr_t,
>,
pub udata_copy: Option<extern "C" fn(udata: *mut c_void) -> *mut c_void>,
pub udata_free: Option<extern "C" fn(udata: *mut c_void) -> herr_t>,
pub udata_copy: Option<unsafe extern "C" fn(udata: *mut c_void) -> *mut c_void>,
pub udata_free: Option<unsafe extern "C" fn(udata: *mut c_void) -> herr_t>,
pub udata: *mut c_void,
}

Expand Down
16 changes: 9 additions & 7 deletions hdf5-sys/src/h5i.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ pub type hid_t = c_int;
pub const H5I_INVALID_HID: hid_t = -1;

#[cfg(not(feature = "1.14.0"))]
pub type H5I_free_t = Option<extern "C" fn(arg1: *mut c_void) -> herr_t>;
pub type H5I_free_t = Option<unsafe extern "C" fn(arg1: *mut c_void) -> herr_t>;
#[cfg(feature = "1.14.0")]
pub type H5I_free_t = Option<extern "C" fn(*mut c_void, *mut *mut c_void) -> herr_t>;
pub type H5I_free_t = Option<unsafe extern "C" fn(*mut c_void, *mut *mut c_void) -> herr_t>;

pub type H5I_search_func_t =
Option<extern "C" fn(obj: *mut c_void, id: hid_t, key: *mut c_void) -> c_int>;
Option<unsafe extern "C" fn(obj: *mut c_void, id: hid_t, key: *mut c_void) -> c_int>;
#[cfg(feature = "1.12.0")]
pub type H5I_iterate_func_t = Option<extern "C" fn(id: hid_t, udata: *mut c_void) -> herr_t>;
pub type H5I_iterate_func_t = Option<unsafe extern "C" fn(id: hid_t, udata: *mut c_void) -> herr_t>;

extern "C" {
pub fn H5Iregister(type_: H5I_type_t, object: *const c_void) -> hid_t;
Expand Down Expand Up @@ -79,11 +79,13 @@ extern "C" {
}

#[cfg(feature = "1.14.0")]
pub type H5I_future_realize_func_t =
Option<extern "C" fn(future_object: *mut c_void, actual_object_id: *mut hid_t) -> herr_t>;
pub type H5I_future_realize_func_t = Option<
unsafe extern "C" fn(future_object: *mut c_void, actual_object_id: *mut hid_t) -> herr_t,
>;

#[cfg(feature = "1.14.0")]
pub type H5I_future_discard_func_t = Option<extern "C" fn(future_object: *mut c_void) -> herr_t>;
pub type H5I_future_discard_func_t =
Option<unsafe extern "C" fn(future_object: *mut c_void) -> herr_t>;

#[cfg(feature = "1.14.0")]
extern "C" {
Expand Down
43 changes: 39 additions & 4 deletions hdf5-sys/src/h5l.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//! Creating and manipulating links within an HDF5 group
#[cfg(feature = "1.12.0")]
use std::fmt;
use std::mem;

pub use self::H5L_type_t::*;
Expand Down Expand Up @@ -64,14 +66,14 @@ impl H5L_info1_t__u {
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
#[cfg(feature = "1.12.0")]
pub struct H5L_info2_t {
pub type_: H5L_type_t,
pub corder_valid: hbool_t,
pub corder: int64_t,
pub cset: H5T_cset_t,
pub u: H5L_info1_t__u,
pub u: H5L_info2_t__u,
}

#[cfg(feature = "1.12.0")]
Expand All @@ -81,6 +83,29 @@ impl Default for H5L_info2_t {
}
}

#[cfg(feature = "1.12.0")]
impl fmt::Debug for H5L_info2_t {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut debug_struct = f.debug_struct("H5L_info2_t");
debug_struct
.field("type_", &self.type_)
.field("corder_valid", &self.corder_valid)
.field("corder", &self.corder)
.field("cset", &self.cset);

match self.type_ {
H5L_TYPE_HARD => {
debug_struct.field("token", unsafe { &self.u.token });
}
H5L_TYPE_SOFT | H5L_TYPE_EXTERNAL | H5L_TYPE_MAX => {
debug_struct.field("val_size", unsafe { &self.u.val_size });
}
H5L_TYPE_ERROR => {}
}
debug_struct.finish()
}
}

#[repr(C)]
#[derive(Copy, Clone)]
#[cfg(feature = "1.12.0")]
Expand All @@ -96,6 +121,16 @@ impl Default for H5L_info2_t__u {
}
}

#[cfg(feature = "1.12.0")]
impl H5L_info2_t__u {
pub unsafe fn token(&mut self) -> *mut H5O_token_t {
&mut self.token as *mut H5O_token_t
}
pub unsafe fn val_size(&mut self) -> *mut size_t {
&mut self.val_size as *mut size_t
}
}

pub type H5L_create_func_t = Option<
extern "C" fn(
link_name: *const c_char,
Expand Down Expand Up @@ -169,7 +204,7 @@ impl Default for H5L_class_t {
}

pub type H5L_iterate1_t = Option<
extern "C" fn(
unsafe extern "C" fn(
group: hid_t,
name: *const c_char,
info: *const H5L_info1_t,
Expand All @@ -178,7 +213,7 @@ pub type H5L_iterate1_t = Option<
>;
#[cfg(feature = "1.12.0")]
pub type H5L_iterate2_t = Option<
extern "C" fn(
unsafe extern "C" fn(
group: hid_t,
name: *const c_char,
info: *const H5L_info2_t,
Expand Down
4 changes: 2 additions & 2 deletions hdf5-sys/src/h5mm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
use crate::internal_prelude::*;

pub type H5MM_allocate_t =
Option<extern "C" fn(size: size_t, alloc_info: *mut c_void) -> *mut c_void>;
pub type H5MM_free_t = Option<extern "C" fn(mem: *mut c_void, free_info: *mut c_void)>;
Option<unsafe extern "C" fn(size: size_t, alloc_info: *mut c_void) -> *mut c_void>;
pub type H5MM_free_t = Option<unsafe extern "C" fn(mem: *mut c_void, free_info: *mut c_void)>;
2 changes: 1 addition & 1 deletion hdf5-sys/src/h5o.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ pub enum H5O_mcdt_search_ret_t {

#[cfg(feature = "1.8.9")]
pub type H5O_mcdt_search_cb_t =
Option<extern "C" fn(op_data: *mut c_void) -> H5O_mcdt_search_ret_t>;
Option<unsafe extern "C" fn(op_data: *mut c_void) -> H5O_mcdt_search_ret_t>;

#[cfg(not(feature = "1.10.3"))]
extern "C" {
Expand Down
18 changes: 10 additions & 8 deletions hdf5-sys/src/h5p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ pub const H5P_CRT_ORDER_INDEXED: c_uint = 0x0002;
pub const H5P_DEFAULT: hid_t = 0;

pub type H5P_cls_create_func_t =
Option<extern "C" fn(prop_id: hid_t, create_data: *mut c_void) -> herr_t>;
pub type H5P_cls_copy_func_t =
Option<extern "C" fn(new_prop_id: hid_t, old_prop_id: hid_t, copy_data: *mut c_void) -> herr_t>;
Option<unsafe extern "C" fn(prop_id: hid_t, create_data: *mut c_void) -> herr_t>;
pub type H5P_cls_copy_func_t = Option<
unsafe extern "C" fn(new_prop_id: hid_t, old_prop_id: hid_t, copy_data: *mut c_void) -> herr_t,
>;
pub type H5P_cls_close_func_t =
Option<extern "C" fn(prop_id: hid_t, close_data: *mut c_void) -> herr_t>;
Option<unsafe extern "C" fn(prop_id: hid_t, close_data: *mut c_void) -> herr_t>;
pub type H5P_prp_cb1_t =
Option<extern "C" fn(name: *const c_char, size: size_t, value: *mut c_void) -> herr_t>;
Option<unsafe extern "C" fn(name: *const c_char, size: size_t, value: *mut c_void) -> herr_t>;
pub type H5P_prp_cb2_t = Option<
extern "C" fn(prop_id: hid_t, name: *const c_char, size: size_t, value: *mut c_void) -> herr_t,
>;
Expand All @@ -41,11 +42,12 @@ pub type H5P_prp_set_func_t = H5P_prp_cb2_t;
pub type H5P_prp_get_func_t = H5P_prp_cb2_t;
pub type H5P_prp_delete_func_t = H5P_prp_cb2_t;
pub type H5P_prp_copy_func_t = H5P_prp_cb1_t;
pub type H5P_prp_compare_func_t =
Option<extern "C" fn(value1: *const c_void, value2: *const c_void, size: size_t) -> c_int>;
pub type H5P_prp_compare_func_t = Option<
unsafe extern "C" fn(value1: *const c_void, value2: *const c_void, size: size_t) -> c_int,
>;
pub type H5P_prp_close_func_t = H5P_prp_cb1_t;
pub type H5P_iterate_t =
Option<extern "C" fn(id: hid_t, name: *const c_char, iter_data: *mut c_void) -> herr_t>;
Option<unsafe extern "C" fn(id: hid_t, name: *const c_char, iter_data: *mut c_void) -> herr_t>;

pub use self::globals::*;

Expand Down
Loading

0 comments on commit 29df194

Please sign in to comment.