Expand description
Batch classes: a function run over many items that stay on the Rust side.
bridge --batch fuzzyScore:text gives the crate a FuzzyScoreBatch class: the constructor
takes the items (the text values) once; run(query) applies the port to every item on all
cores and returns the results as one typed array; rank(query, min) returns the indexes of
the items whose result is at least min, best first. One call does what a loop of per-item
calls did, so the crossing is paid once instead of per item.
The default index calls the port per item. A port can do better by defining
pub struct FuzzyScoreIndex in port.rs with pub fn new(items: Vec<T>) -> Self and
pub fn run(&self, <other params>) -> Result<Vec<R>, String>: it can prepare the items once
(lowercase them, build masks) and the class uses it instead.
Structs§
- Batch
--batch function:param: runfunctionover many values ofparam.
Functions§
- index_
cjs - The
index.cjspart that sends and receives the values of [fast_batches] in bulk. - js_rs
- Batch classes for a napi-rs or wasm-bindgen
lib.rs. - needs_
rayon - Whether the crate depends on rayon: every crate with batches. Wasm gets it too, so a
port.rsindex using it builds for both kinds: without threads, rayon runs on the calling thread. - pascal
- py_rs
- Batch classes for a PyO3
lib.rs, and the names to register.