0.2.0
deno_bindgen
0.2.0
New features
--release
accepts URLs and pass them to plug by @littledivy in #10- preserve Rust docs in JS bindings by @littledivy in #13
- support
non_blocking
attribute for symbols by @littledivy in #14 - add support for
&str
by @littledivy in #15 - add support for
&[u8]
by @littledivy in #16 - Add support for
enum
s by @littledivy in #17 - add support for serde attributes by @littledivy in #18
- autoformat with dprint WASM by @littledivy in #19
Usage
use deno_bindgen::deno_bindgen;
#[deno_bindgen]
pub struct Input {
/// Doc comments are transformed into
/// jsdocs.
a: Vec<Vec<String>>,
}
#[deno_bindgen(non_blocking)]
pub fn say_hello(message: &str) {
println!("{}", message);
}
Generated bindings will look like this:
// bindings/binding.ts
// ... <init code here>
type Input = {
/**
* Doc comments are transformed into
* jsdocs.
**/
a: Array<Array<string>>;
};
export async function say_hello(message: string) {
// ... <glue code for symbol here>
}
These bindings contain nessecary code to open the shared library, define symbols and expose type definitions. They can be simply imported into Deno code:
import { say_hello } from "./bindings/bindings.ts";
await say_hello("Demn!")
Full Changelog: 0.1.1...0.2.0