zarrs_ffi
FFI bindings for the zarrs crate, a rust library for the Zarr V3 storage format for multidimensional arrays and metadata.
Developed at the Department of Materials Physics, Australian National University, Canberra, Australia.
zarrs and zarrs_ffi are experimental and in limited production use. Use at your own risk!
Example usage can be found in the examples.
Currently zarrs_ffi only supports a small subset of the zarrs API.
CMake Quickstart
zarrs_ffi can build from source and be available as the zarrs::zarrs target in a CMake project with the below snippet.
This uses corrosion. The rust compiler and cargo must be installed.
include(FetchContent)
FetchContent_Declare(Corrosion
GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git
GIT_TAG v0.4
)
FetchContent_MakeAvailable(Corrosion)
FetchContent_Declare(zarrs_ffi_source
GIT_REPOSITORY https://github.com/LDeakin/zarrs_ffi.git
GIT_TAG v0.5.0
)
FetchContent_Populate(zarrs_ffi_source)
corrosion_import_crate(MANIFEST_PATH ${zarrs_ffi_source_SOURCE_DIR}/Cargo.toml)
target_include_directories(zarrs_ffi INTERFACE ${zarrs_ffi_source_SOURCE_DIR})
add_library(zarrs::zarrs ALIAS zarrs_ffi)
A more complete CMake example can be found in examples/cmake_project.
Manual Install
Basic Build
Building generates a header, static library, 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).
This can be enabled by compiling 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 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.