blosc2_src/
lib.rs

1//! This crate is for building `c-blosc` and linking to the static build.
2
3#![allow(clippy::redundant_static_lifetimes)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6
7use std::{ffi::c_void, ptr::null_mut};
8
9pub use libc::FILE;
10
11#[cfg(not(windows))]
12pub use libc::timespec;
13
14#[cfg(windows)]
15pub type LARGE_INTEGER = i64;
16
17#[cfg(not(feature = "bindgen"))]
18include!("bindings.rs");
19#[cfg(feature = "bindgen")]
20include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
21
22/// Defaults mirror BLOSC2_CPARAMS_DEFAULTS in blosc2.h
23///
24/// static const values are compile time constructs, and can't have bindings
25/// generated to them.
26pub const BLOSC2_CPARAMS_DEFAULTS: blosc2_cparams = blosc2_cparams {
27    compcode: BLOSC_BLOSCLZ as u8,
28    compcode_meta: 0,
29    clevel: 5,
30    use_dict: 0,
31    typesize: 8,
32    nthreads: 1,
33    blocksize: 0,
34    splitmode: BLOSC_FORWARD_COMPAT_SPLIT as std::os::raw::c_int,
35    schunk: null_mut::<c_void>(),
36    filters: [0, 0, 0, 0, 0, BLOSC_SHUFFLE as u8],
37    filters_meta: [0, 0, 0, 0, 0, 0],
38    prefilter: None,
39    preparams: null_mut::<blosc2_prefilter_params>(),
40    tuner_params: null_mut::<c_void>(),
41    tuner_id: 0,
42    instr_codec: false,
43    codec_params: null_mut::<c_void>(),
44    filter_params: [
45        null_mut::<c_void>(),
46        null_mut::<c_void>(),
47        null_mut::<c_void>(),
48        null_mut::<c_void>(),
49        null_mut::<c_void>(),
50        null_mut::<c_void>(),
51    ],
52};
53
54impl Default for blosc2_cparams {
55    fn default() -> Self {
56        BLOSC2_CPARAMS_DEFAULTS
57    }
58}
59
60/// Defaults mirror BLOSC2_DPARAMS_DEFAULTS in blosc2.h
61///
62/// static const values are compile time constructs, and can't have bindings
63/// generated to them.
64pub const BLOSC2_DPARAMS_DEFAULTS: blosc2_dparams = blosc2_dparams {
65    nthreads: 1,
66    schunk: null_mut::<c_void>(),
67    postfilter: None,
68    postparams: null_mut::<blosc2_postfilter_params>(),
69};
70
71impl Default for blosc2_dparams {
72    fn default() -> Self {
73        BLOSC2_DPARAMS_DEFAULTS
74    }
75}