stringzilla 5.1.2

Search, hash, sort, fingerprint, and fuzzy-match strings faster via SWAR, SIMD, and GPGPU
Documentation
[package]
authors = ["Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>"]
# Not `external-ffi-bindings`: that is for a library built elsewhere, and `c/` is vendored and built by `build.rs`.
categories = ["text-processing", "hardware-support", "no-std", "wasm"]
description = "Search, hash, sort, fingerprint, and fuzzy-match strings faster via SWAR, SIMD, and GPGPU"
documentation = "https://docs.rs/stringzilla"
edition = "2021"
homepage = "https://ashvardanian.com/posts/stringzilla/"
# Leading slashes anchor to the package root; Cargo matches these like gitignore. No `forkunion/**`: `build.rs` reads
# those headers from `DEP_FORKUNION_INCLUDE`, exported by the `forkunion` crate.
include = [
  "/rust/**",
  "/c/**",
  "/include/**",
  "/probes/**",
  "/build.rs",
  "/LICENSE",
]
keywords = ["simd", "search", "retrieval", "hash", "sort"]
license = "Apache-2.0"
# The bundled C sources export global `sz_*` symbols, so `links` makes Cargo refuse a graph holding two copies of this
# crate. It adds exclusivity to resolution only; the linking itself stays in `build.rs`.
links = "stringzilla"
name = "stringzilla"
publish = true
repository = "https://github.com/ashvardanian/StringZilla"
# The `Byteset` mutators are `const fn` taking `&mut self`, which needs `const_mut_refs`, stable since 1.83.
rust-version = "1.83"
version = "5.1.2"

[lib]
name = "stringzilla"
path = "rust/lib.rs"

[features]
default = ["std", "dynamic-dispatch"]
std = []
# Runtime SIMD dispatch: compile every ISA tier and pick the best one at load via the dispatch table
# (mirrors CMake's `stringzilla_shared`). Disable (`--no-default-features`) to resolve the tier at
# compile time instead - the analog of the header-only `stringzilla_header`.
cpus = [
  "std", # std is required for multi-threaded backend
  "dep:allocator-api2",
  "dep:stringtape",
  "dep:forkunion", # Compiles and links the thread-pool runtime; StringZillas only consumes its C API
] # Multi-threaded CPU backend (StringZillas)
cuda = ["std", "cpus"] # CUDA GPU backend (includes multi-threaded CPU backend)
dynamic-dispatch = []
rocm = ["std", "cpus"] # ROCm GPU backend (includes multi-threaded CPU backend)

[dependencies]
allocator-api2 = {version = "0.4", optional = true}
forkunion = {version = "3.0", optional = true}
stringtape = {version = "2.4.2", optional = true}

[build-dependencies]
cc = "1.2.47"

[lints.clippy]
# Catch platform-specific type issues like `c_char` differences
cast-sign-loss = "warn"
# Catch potential FFI issues
not-unsafe-ptr-arg-deref = "warn"
# Catch undefined behavior with pointers
invalid_null_ptr_usage = "warn"
# Catch transmute issues
transmute_ptr_to_ptr = "warn"

[lints.rust]
# Catch ABI mismatches in FFI
improper_ctypes = "warn"
# Catch platform-specific code that might fail on other targets
unexpected_cfgs = "warn"

[profile.release]
# Align the optimized build with the CMake and Python builds at -O2; `build.rs` forwards this `OPT_LEVEL`
# to `cc` for the bundled C/C++ sources. -O3's aggressive inlining bloats the heavy `utf8_uncased`
# translation unit (~3 MB object, ~44s to compile) with no measured runtime win. `dev` keeps the default
# -O0 so clean builds stay fast.
opt-level = 2