hdf5_sys/
lib.rs

1//! Rust bindings to the `hdf5` library for reading and writing data to and from storage
2#![allow(non_camel_case_types, non_snake_case, dead_code, deprecated)]
3#![cfg_attr(feature = "cargo-clippy", allow(clippy::unreadable_literal))]
4#![cfg_attr(feature = "cargo-clippy", allow(clippy::missing_safety_doc))]
5#![cfg_attr(feature = "cargo-clippy", allow(clippy::cognitive_complexity))]
6#![cfg_attr(feature = "cargo-clippy", allow(clippy::upper_case_acronyms))]
7#![cfg_attr(docsrs, feature(doc_cfg))]
8
9macro_rules! extern_static {
10    ($dest:ident, $src:ident) => {
11        extern "C" {
12            static $src: id_t;
13        }
14        pub static $dest: &'static id_t = unsafe { &$src };
15    };
16}
17
18#[cfg(all(feature = "mpio", not(feature = "have-parallel")))]
19compile_error!("Enabling \"mpio\" feature requires HDF5 library built with MPI support");
20
21#[cfg(all(feature = "mpio", feature = "static"))]
22compile_error!("\"mpio\" and \"static\" are incompatible features");
23
24pub mod h5;
25pub mod h5a;
26pub mod h5ac;
27pub mod h5c;
28pub mod h5d;
29pub mod h5e;
30pub mod h5f;
31pub mod h5fd;
32pub mod h5g;
33pub mod h5i;
34pub mod h5l;
35pub mod h5mm;
36pub mod h5o;
37pub mod h5p;
38pub mod h5r;
39pub mod h5s;
40pub mod h5t;
41pub mod h5vl;
42pub mod h5z;
43
44#[cfg(feature = "1.8.15")]
45pub mod h5pl;
46
47#[allow(non_camel_case_types)]
48mod internal_prelude {
49    pub use crate::h5::{
50        haddr_t, hbool_t, herr_t, hsize_t, hssize_t, htri_t, H5_ih_info_t, H5_index_t,
51        H5_iter_order_t,
52    };
53    pub use crate::h5i::hid_t;
54    pub use crate::h5t::H5T_cset_t;
55    pub use libc::{int64_t, off_t, size_t, ssize_t, time_t, uint32_t, uint64_t, FILE};
56    pub use std::os::raw::{
57        c_char, c_double, c_float, c_int, c_long, c_longlong, c_uchar, c_uint, c_ulong,
58        c_ulonglong, c_void,
59    };
60}
61
62#[cfg(test)]
63mod tests {
64    use super::h5::H5open;
65    use super::h5p::H5P_CLS_ROOT;
66
67    #[test]
68    pub fn test_smoke() {
69        unsafe {
70            H5open();
71            assert!(*H5P_CLS_ROOT > 0);
72        }
73    }
74}