https://github.com/BruJu/wasmify-sophia
wasm_bindgen_dataset!(TreedDataset, "TreedDataset", SophiaExportDataset);
+use crate::wrapping::*;
+
+#[wasm_bindgen(js_class="TreedDataset")]
+impl SophiaExportDataset {
+ pub fn get_nb_underlying(&self) -> usize {
+ self.base.dataset().get_number_of_underlying_trees()
+ }
+}
And that's it.
Explanation
- The third argument is the name of the class that will be exported
- Rust enables you to define multiple impl block
base
is the adapter,base.dataset()
is the Sophia compliant dataset