Skip to content

Commit 8229fd1

Browse files
authored
Updated node-bindgen minor version and updated README (#106)
1 parent 7d6d730 commit 8229fd1

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "node-bindgen"
3-
version = "4.0.0"
3+
version = "4.0.1"
44
authors = ["Fluvio Contributors <[email protected]>"]
55
edition = "2018"
66
description = "easy way to write nodejs module using rust"

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
- __Async:__ Support Async Rust. Async codes are translated into Node.js promises.
4545
- __Class:__ Rust struct can be accessed using Node.js classes.
4646
- __Stream:__ Implement Node.js stream using Rust
47-
- __N-API:__ Use Node.js N-API, which means you don't have to recompile your module.
47+
- __N-API:__ Use Node.js N-API, which means you don't have to recompile your module.
4848

4949
# Compatibility with Node.js version
5050

@@ -59,7 +59,7 @@ Following OS are supported:
5959

6060
# Why node-bindgen?
6161

62-
Writing native node-js requires lots of boilerplate code. Node-bindgen generates external "C" glue code from rust code, including native module registration. node-bindgen make it writing node-js module easy and fun.
62+
Writing native node-js requires lots of boilerplate code. Node-bindgen generates external "C" glue code from rust code, including native module registration. node-bindgen make it writing node-js module easy and fun.
6363

6464

6565
# Getting started
@@ -76,18 +76,18 @@ This is one time step.
7676

7777
## Configuring Cargo.toml
7878

79-
Add two dependencies to your projects' ```Cargo.toml```.
79+
Add two dependencies to your projects' ```Cargo.toml```.
8080

8181
Add ```node-bindgen``` as a regular dependency (as below):
8282
```
8383
[dependencies]
84-
node-bindgen = { version = "3.0.0" }
84+
node-bindgen = { version = "4.0" }
8585
```
8686

8787
Then add ```node-bindgen```'s procedure macro to your build-dependencies as below:
8888
```
8989
[build-dependencies]
90-
node-bindgen = { version = "3.0.0", features = ["build"] }
90+
node-bindgen = { version = "4.0", features = ["build"] }
9191
```
9292

9393
Then update crate type to ```cdylib``` to generate node.js compatible native module:
@@ -116,7 +116,7 @@ use node_bindgen::derive::node_bindgen;
116116

117117
/// add two integer
118118
#[node_bindgen]
119-
fn sum(first: i32, second: i32) -> i32 {
119+
fn sum(first: i32, second: i32) -> i32 {
120120
first + second
121121
}
122122

@@ -141,7 +141,7 @@ nj-cli build --release
141141

142142
While developing your native module, you may want to watch for file changes and run a command when a change occurs, for example `cargo check` or `cargo build`.
143143

144-
For this, we can use `nj-cli watch`.
144+
For this, we can use `nj-cli watch`.
145145

146146
`nj-cli watch` installs <small>[if it does not exist]</small> and passes arguments to [`cargo watch`](https://crates.io/crates/cargo-watch). By default, `nj-cli watch` will run `cargo check` against your `./src` files.
147147

@@ -161,7 +161,7 @@ Type ".help" for more information.
161161
undefined
162162
> addon.sum(2,3)
163163
5
164-
>
164+
>
165165
```
166166

167167

@@ -171,8 +171,8 @@ undefined
171171

172172
```rust
173173
#[node_bindgen(name="multiply")]
174-
fn mul(first: i32,second: i32) -> i32 {
175-
first * second
174+
fn mul(first: i32,second: i32) -> i32 {
175+
first * second
176176
}
177177
```
178178

@@ -183,7 +183,7 @@ Rust function mul is re-mapped as ```multiply```
183183
Argument can be skipped if it is marked as optional
184184
```rust
185185
#[node_bindgen]
186-
fn sum(first: i32, second: Option<i32>) -> i32 {
186+
fn sum(first: i32, second: Option<i32>) -> i32 {
187187
first + second.unwrap_or(0)
188188
}
189189
```
@@ -293,7 +293,7 @@ There are more features in the examples folder.
293293
## Windows + Electron Support
294294
When using node-bindgen with electron on Windows, `nj-build` must
295295
compile a C++ file, `win_delay_load_hook.cc`, and therefore it is required that the development
296-
environment has a valid C/C++ compiler.
296+
environment has a valid C/C++ compiler.
297297

298298
> If your machine does not have a valid C/C++ compiler, install [Microsoft VSCode](https://code.visualstudio.com/docs/cpp/config-mingw).
299299

0 commit comments

Comments
 (0)