deno_bindgen
deno_bindgen copied to clipboard
implement `impl` as classes
Doable with Box<T>
. Reference/Mutable reference for methods and deallocate box when consumed/finalization
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 }
}
}
const ptr = new NonSerializable();
ptr.add(10)