Skip to content

0.2.0

Compare
Choose a tag to compare
@littledivy littledivy released this 20 Oct 04:35
· 76 commits to main since this release
bdcdaca

deno_bindgen 0.2.0

New features

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