#hdf5 #plugin #binding #call #register #filter #bitshuffle

sys hdf5-bitshuffle

HDF5 bitshuffle plugin for Rust

5 releases (3 breaking)

0.9.0 Feb 27, 2022
0.8.0 Oct 25, 2021
0.2.0 May 21, 2021
0.1.1 May 20, 2021
0.1.0 May 20, 2021

#25 in #hdf5


Used in 3 crates (via cryiorust)

MIT license

300KB
6K SLoC

C 4K SLoC // 0.2% comments Python 1K SLoC // 0.1% comments Cython 461 SLoC // 0.3% comments Rust 91 SLoC Shell 12 SLoC Forge Config 7 SLoC Batch 3 SLoC

hdf5-bitshuffle

This is a Rust binding of bitshuffle HDF5 filter. Some HDF5 files use this not standard plugin bitshuffle (mainly produced by the Dectris Eiger detectors). This crate makes a binding for Rust.

To use this plugin just call in your code before using any HDF5 API:

use hdf5_bitshuffle::register_bitshuffle_plugin;

fn main() {
     register_bitshuffle_plugin();
}

Or, if you want more control, you can call it manually:

use std::sync::Once;
use hdf5_bitshuffle::bshuf_register_h5filter;

static REGISTER_BITSHUFFLE: Once = Once::new();

fn main() {
    unsafe {
        REGISTER_BITSHUFFLE.call_once(|| {
                if bshuf_register_h5filter() < 0 {
                    panic!("Could not register bitshuffle plugin for HDF5");
                }
            });
        }
}

License: MIT


lib.rs:

This is a Rust binding of bitshuffle HDF5 filter. Some HDF5 files use this not standard plugin bitshuffle (mainly produced by the Dectris Eiger detectors). This crate makes a binding for Rust.

To use this plugin just call in your code before using any HDF5 API:

use hdf5_bitshuffle::register_bitshuffle_plugin;

fn main() {
     register_bitshuffle_plugin();
}

Or, if you want more control, you can call it manually:

use std::sync::Once;
use hdf5_bitshuffle::bshuf_register_h5filter;

static REGISTER_BITSHUFFLE: Once = Once::new();

fn main() {
    unsafe {
        REGISTER_BITSHUFFLE.call_once(|| {
                if bshuf_register_h5filter() < 0 {
                    panic!("Could not register bitshuffle plugin for HDF5");
                }
            });
        }
}

Dependencies

~16MB
~214K SLoC