{"id":15573033,"url":"https://github.com/ldeakin/zarrs_ffi","last_synced_at":"2025-04-24T02:15:11.397Z","repository":{"id":196460354,"uuid":"696120900","full_name":"LDeakin/zarrs_ffi","owner":"LDeakin","description":"C/C++ bindings for the zarrs rust crate","archived":false,"fork":false,"pushed_at":"2025-02-24T08:58:32.000Z","size":447,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T02:15:02.912Z","etag":null,"topics":["c","cpp","library","zarr","zarr-v3","zarrs"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LDeakin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-09-25T06:08:26.000Z","updated_at":"2025-03-21T20:48:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"1f75de4f-a7ab-48b9-813e-30f771f1fd36","html_url":"https://github.com/LDeakin/zarrs_ffi","commit_stats":null,"previous_names":["ldeakin/zarrs-ffi"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LDeakin%2Fzarrs_ffi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LDeakin%2Fzarrs_ffi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LDeakin%2Fzarrs_ffi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LDeakin%2Fzarrs_ffi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LDeakin","download_url":"https://codeload.github.com/LDeakin/zarrs_ffi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250546097,"owners_count":21448263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cpp","library","zarr","zarr-v3","zarrs"],"created_at":"2024-10-02T18:10:11.121Z","updated_at":"2025-04-24T02:15:11.365Z","avatar_url":"https://github.com/LDeakin.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zarrs_ffi\n\n[![Latest Version](https://img.shields.io/crates/v/zarrs_ffi.svg)](https://crates.io/crates/zarrs_ffi)\n[![zarrs documentation](https://img.shields.io/badge/docs-Doxygen-green)](https://ldeakin.github.io/zarrs_ffi/)\n[![zarrs documentation](https://img.shields.io/badge/docs-docs.rs-green)](https://docs.rs/zarrs_ffi)\n![msrv](https://img.shields.io/crates/msrv/zarrs_ffi)\n[![build](https://github.com/LDeakin/zarrs_ffi/actions/workflows/ci.yml/badge.svg)](https://github.com/LDeakin/zarrs_ffi/actions/workflows/ci.yml)\n\nC/C++ bindings for the [zarrs] crate, a Rust library for the [Zarr](https://zarr.dev) storage format for multidimensional arrays and metadata.\n\n`zarrs_ffi` is a single header library: `zarrs.h` [(docs)](https://ldeakin.github.io/zarrs_ffi/zarrs_8h.html).\n\nCurrently `zarrs_ffi` only supports a small subset of the [zarrs] API.\n\nA changelog can be found [here](https://github.com/LDeakin/zarrs_ffi/blob/main/CHANGELOG.md).\n\n## Example\n```C++\n#include \"zarrs.h\"\n\nvoid main() {\n  // Open a filesystem store pointing to a zarr hierarchy\n  ZarrsStorage storage = nullptr;\n  zarrs_assert(zarrsCreateStorageFilesystem(\"/path/to/hierarchy.zarr\", \u0026storage));\n\n  // Open an array in the hierarchy\n  ZarrsArray array = nullptr;\n  zarrsOpenArrayRW(storage, \"/array\", metadata, \u0026array);\n\n  // Get the array dimensionality\n  size_t dimensionality;\n  zarrs_assert(zarrsArrayGetDimensionality(array, \u0026dimensionality));\n  assert(dimensionality == 2);\n\n  // Retrieve the decoded bytes of the chunk at [0, 0]\n  size_t indices[] = {0, 0};\n  size_t chunk_size;\n  zarrs_assert(zarrsArrayGetChunkSize(array, 2, indices, \u0026chunk_size));\n  std::unique_ptr\u003cuint8_t[]\u003e chunk_bytes(new uint8_t[chunk_size]);\n  zarrs_assert(zarrsArrayRetrieveChunk(array, 2, indices, chunk_size, chunk_bytes.get()));\n}\n```\n\nSee a more comprehensive example in the [examples](https://github.com/LDeakin/zarrs_ffi/tree/main/examples) directory.\n\n## CMake Quickstart\n1. Install the Rust compiler (and cargo).\n2. Put [Findzarrs.cmake](https://github.com/LDeakin/zarrs_ffi/blob/main/examples/cmake_project/Findzarrs.cmake) in your `CMAKE_MODULE_PATH`\n3. `find_package(zarrs \u003cversion\u003e REQUIRED COMPONENTS zarrs/bz2)`\n   - Replace `\u003cversion\u003e` with the latest release: [![Latest Version](https://img.shields.io/crates/v/zarrs_ffi.svg)](https://crates.io/crates/zarrs_ffi) (e.g., `0.9` or `0.9.1`)\n   - [zarrs] is retrieved from `GitHub` using [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html) and built using [corrosion](https://github.com/corrosion-rs/corrosion)\n   - Components are optional [zarrs] codecs\n4. the `zarrs_ffi` library is available as the `zarrs::zarrs` or  `zarrs::zarrs-static` target\n\nA complete `CMake` example can be found in [examples/cmake_project](https://github.com/LDeakin/zarrs_ffi/tree/main/examples/cmake_project).\n\n## Manual Build\n\n#### Basic Build\nBuilding generates a header, and a platform-dependent static and dynamic library.\n```bash\ncargo build --release --features cbindgen # -\u003e zarrs.h and target/release/[lib]zarrs_ffi{.a,.so,.dll,.dylib}\n```\n`zarrs.h` is only re-generated if the `cbindgen` feature is enabled.\n\n#### Enabling SIMD intrinsics\nEncoding and decoding performance may be improved with `avx2`/`sse2` enabled (if supported).\nCompile with either of:\n - `RUSTFLAGS=\"-C target-cpu=native\"`\n - `RUSTFLAGS=\"-C target-feature=+avx2,+sse2\"`\n\n#### Enabling non-default zarrs codecs\nNon-default `zarrs` codecs (see [`zarrs` crate features](https://docs.rs/zarrs/latest/zarrs/#crate-features)) can be enabled with the `all_codecs` feature.\nAlternatively, individual codecs can be enabled by passing them as feature flags.\nFor example:\n```bash\ncargo build --release --features cbindgen --features zarrs/zstd,zarrs/bitround,zarrs/zfp,zarrs/bz2,zarrs/pcodec,zarrs/gdeflate\n```\n\n## Licence\n`zarrs_ffi` is licensed under either of\n - the Apache License, Version 2.0 [LICENSE-APACHE](./LICENCE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e or\n - the MIT license [LICENSE-MIT](./LICENCE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e, at your option.\n\nUnless 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.\n\n[zarrs]: https://github.com/LDeakin/zarrs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fldeakin%2Fzarrs_ffi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fldeakin%2Fzarrs_ffi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fldeakin%2Fzarrs_ffi/lists"}