zvec 0.1.0

Rust bindings to zvec, an in-process vector database by Alibaba.
Documentation
[package]
name = "zvec"
version = "0.1.0"
edition = "2021"
rust-version = "1.75"
license = "Apache-2.0"
description = "Rust bindings to zvec, an in-process vector database by Alibaba."
repository = "https://github.com/oly-wan-kenobi/zvec-rs"
documentation = "https://docs.rs/zvec"
homepage = "https://github.com/oly-wan-kenobi/zvec-rs"
readme = "README.md"
keywords = ["vector", "database", "embedding", "ann", "ffi"]
categories = ["api-bindings", "database"]
links = "zvec_c_api"
exclude = [
    "/.github",
    "/target",
    "/zvec-derive/target",
    "/CHANGELOG.md",
    "/PUBLISHING.md",
    "/scripts",
]

[workspace]
members = [".", "zvec-derive"]

[features]
default = []
# Try pkg-config first to locate the zvec C API library.
pkg-config = ["dep:pkg-config"]
# Download upstream zvec's PyPI wheel at build time and extract
# `libzvec_c_api.so` (or the platform equivalent) plus `c_api.h` into
# `OUT_DIR`, then link against that. Supported targets: Linux x86_64 /
# aarch64, macOS arm64, Windows x86_64. On unsupported targets the build
# falls back to the regular `ZVEC_LIB_DIR` / `ZVEC_ROOT` / `pkg-config`
# discovery flow.
bundled = ["dep:ureq", "dep:zip", "dep:sha2"]
# JSON <-> Doc bridge: `Doc::from_json(&serde_json::Value, &CollectionSchema)`.
# Pulls in `serde_json` as a runtime dependency.
serde-json = ["dep:serde_json"]
# Typed `half::f16` vector helpers. Without this feature, FP16 vectors
# are only reachable through the raw `add_vector_fp16_bits(&[u16])` /
# `get_vector_fp16_bits` entry points.
half = ["dep:half"]
# Async wrapper around `Collection` that bridges every blocking operation
# through `tokio::task::spawn_blocking`. Requires a running tokio runtime.
tokio = ["dep:tokio"]
# `#[derive(IntoDoc)]` — struct-to-Doc conversion via a proc macro.
derive = ["dep:zvec-derive"]

[dependencies]
serde_json = { version = "1", optional = true }
half = { version = "2", optional = true }
tokio = { version = "1", default-features = false, features = ["rt"], optional = true }
zvec-derive = { version = "0.1", path = "zvec-derive", optional = true }

[dev-dependencies]
tokio = { version = "1", default-features = false, features = ["rt-multi-thread", "macros"] }

[build-dependencies]
bindgen = "0.70"
pkg-config = { version = "0.3", optional = true }
ureq = { version = "2.10", default-features = false, features = ["tls"], optional = true }
zip = { version = "2.2", default-features = false, features = ["deflate"], optional = true }
sha2 = { version = "0.10", optional = true }

[[example]]
name = "version"
path = "examples/version.rs"

[[example]]
name = "basic"
path = "examples/basic.rs"

[[example]]
name = "semantic_search"
path = "examples/semantic_search.rs"

[[example]]
name = "hybrid_search"
path = "examples/hybrid_search.rs"

[[example]]
name = "json_ingest"
path = "examples/json_ingest.rs"
required-features = ["serde-json"]

[package.metadata.docs.rs]
# docs.rs doesn't have a zvec library installed, so we skip linking via
# the DOCS_RS env var (see build.rs) and only emit the FFI declarations.
# Enabling every optional feature makes the full surface (AsyncCollection,
# IntoDoc derive, from_json, half::f16 helpers, rerankers, hybrid search,
# …) show up with proper `doc(cfg)` feature badges.
all-features = true
rustdoc-args = ["--cfg", "docsrs"]