5 releases

new 0.6.2 Apr 20, 2024
0.6.1 Apr 20, 2024
0.6.0 Apr 2, 2024
0.5.1 Mar 18, 2024
0.5.0 Mar 10, 2024

#838 in Encoding

Download history 142/week @ 2024-03-09 128/week @ 2024-03-16 10/week @ 2024-03-23 243/week @ 2024-03-30 14/week @ 2024-04-06

399 downloads per month

MIT/Apache

40KB
748 lines

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

  1. Install the rust compiler (and cargo).
  2. Put Findzarrs.cmake in your CMAKE_MODULE_PATH
  3. find_package(zarrs 0.6 REQUIRED COMPONENTS zarrs/bz2)
    • zarrs is retrieved from GitHub using FetchContent and built using corrosion
    • Components are optional zarrs codecs
  4. the zarrs FFI library is available as the zarrs::zarrs target

A complete CMake example can be found in examples/cmake_project.

Manual Build

Basic Build

Building generates a header, and a platform-dependent static and dynamic library.

cargo build --release --features cbindgen # -> zarrs.h and target/release/[lib]zarrs_ffi{.a,.so,.dll,.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). 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 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.

Dependencies

~10–19MB
~244K SLoC