Patches Directory
CRITICAL: Do not delete this directory or its contents!
This directory contains patched versions of external crates that are necessary for building RuVector.
hnsw_rs
The hnsw_rs directory contains a patched version of the hnsw_rs crate.
Why this patch exists
The official hnsw_rs crate uses rand 0.9 which is incompatible with WebAssembly (WASM) builds. This patched version:
- Uses
rand 0.8instead ofrand 0.9for WASM compatibility - Uses Rust edition 2021 (not 2024) for stable Rust toolchain compatibility
How it's used
The patch is applied via Cargo.toml at the workspace root:
[patch.crates-io]
hnsw_rs = { path = "./patches/hnsw_rs" }
This ensures all workspace crates that depend on hnsw_rs use this patched version.
What depends on it
ruvector-core(withhnswfeature enabled by default)ruvector-graph(withhnsw_rsfeature)- All native builds (Node.js bindings, CLI tools)
Consequences of deletion
If this directory is deleted:
- All CI builds will fail (Build Native Modules, PostgreSQL Extension CI, etc.)
cargo buildwill fail with "failed to load source for dependencyhnsw_rs"- The project cannot be compiled
Updating the patch
If you need to update hnsw_rs:
- Download the new version from crates.io
- Apply the rand 0.8 compatibility changes from the current patch
- Test WASM and native builds before committing