1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright 2020-2021 the Deno authors. All rights reserved. MIT license.
//! ## deno_bindgen
//! This tool aims to simply types & glue code generation for FFI
//! libraries written in Rust.
//!
//! ### Usage
//! Add `serde` and `deno_bindgen` dependency to your crate.
//!
//! ```
//! 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!")
//! ```
//!
pub use serde_json;
pub use deno_bindgen;