Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

haystackfm is a Rust crate published on crates.io. Its minimum supported Rust version (MSRV) is 1.87.

CPU only (default)

cargo add haystackfm

The default cpu feature builds and queries indices entirely on the CPU — no GPU driver or wgpu dependency required.

With GPU acceleration

cargo add haystackfm --features gpu

The gpu feature pulls in wgpu and enables GPU-accelerated construction plus the batched GPU query paths. On native targets it uses Vulkan, Metal, or DX12 depending on your platform.

For the browser (WebAssembly)

cargo add haystackfm --features wasm

Build the WASM package with wasm-pack:

wasm-pack build --target web --features wasm

This emits a pkg/ directory with haystackfm.js + haystackfm_bg.wasm and TypeScript type definitions. See WebAssembly for the JS/TS API.

Feature flags at a glance

FlagDefaultDescription
cpuyesCPU construction and queries
gpunoWebGPU-accelerated construction and queries via wgpu
wasmnowasm-bindgen JS/TS bindings (implies gpu)

See Feature Flags for details.