zarrs_ffi 0.5.0

FFI bindings for the zarrs crate
Documentation

zarrs_ffi

Latest Version zarrs documentation msrv build

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.

cargo build --release --features cbindgen # -> zarrs.h and target/release/[lib]{zarrs.a,zarrs.so,zarrs.dll,zarrs.dylib}

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:

cargo build --release --features cbindgen --features zarrs/bitround,zarrs/zfp,zarrs/bz2,zarrs/pcodec

Licence

zarrs_ffi is licensed under either of

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.