deno_bindgen
deno_bindgen copied to clipboard
[wip] feat: implement "object wraps"
trafficstars
Closes #63
Rust structs as JavaScript classes. Prior art: wasm_bindgen & napi-rs.
pub struct NonSerializable {
inner: i32,
}
#[deno_bindgen]
impl NonSerializable {
pub fn add(&mut self, a: i32) {
self.inner += a;
}
#[deno_bindgen(constructor)]
pub fn new() -> Self {
Self { inner: 0 }
}
}
import { NonSerializable } from "./bindings/bindings.ts";
const ptr = new NonSerializable();
ptr.add(10)
Hi @littledivy, why was this closed?