zarrs_ffi
C/C++ bindings for the zarrs crate, a Rust library for the Zarr storage format for multidimensional arrays and metadata.
zarrs_ffi is a single header library: zarrs.h (docs).
Currently zarrs_ffi only supports a small subset of the zarrs API.
A changelog can be found here.
Example
void
See a more comprehensive example in the examples directory.
CMake Quickstart
- Install the Rust compiler (and cargo).
- Put Findzarrs.cmake in your
CMAKE_MODULE_PATH find_package(zarrs <version> REQUIRED COMPONENTS zarrs/bz2)- Replace
<version>with the latest release:(e.g.,
0.9or0.9.2) zarrsis retrieved fromGitHubusing FetchContent and built using corrosion- Components are optional
zarrscodecs
- Replace
- the
zarrs_ffilibrary is available as thezarrs::zarrsorzarrs::zarrs-statictarget
A complete CMake example can be found in examples/.
Manual Build
Basic Build
Building generates a header, and a platform-dependent static and dynamic library.
zarrs.h is only re-generated if the cbindgen feature is enabled.
Enabling SIMD intrinsics
Encoding and decoding performance may be improved with avx2/sse2 enabled (if supported).
Compile with either of:
RUSTFLAGS="-C target-cpu=native"RUSTFLAGS="-C target-feature=+avx2,+sse2"
Enabling non-default zarrs codecs
Non-default zarrs codecs (see zarrs crate features) can be enabled with the all_codecs feature.
Alternatively, individual codecs can be enabled by passing them as feature flags.
For example:
Licence
zarrs_ffi is licensed under either of
- the Apache License, Version 2.0 LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0 or
- the MIT license LICENSE-MIT or http://opensource.org/licenses/MIT, at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.