use asearch::Asearch; use wasm_bindgen::prelude::*; #[wasm_bindgen] pub struct ClosureHandle(Closure bool>); #[wasm_bindgen] pub fn asearch(source: &str) -> ClosureHandle { let asearch = Asearch::new(source); let cb = Closure::wrap(Box::new(move |text, ambig| { asearch.find(text, ambig); }) as Box bool>); ClosureHandle(cb) }