Example | Descrption | |
---|---|---|
1. | hello world | Return a hello world string to Node |
2. | primitives | Creating JS primitives in Rust |
3. | arrays | Creating and using JS arrays in Rust |
4. | objects | Creating and using JS objects in Rust |
5. | arguments | Getting and checking function arguments |
6. | functions | Creating and calling JS functions from Rust |
7. | classes | Creating classes |
8. | class factory | Creating classes from a class. Useful for resource pools. |
9. | modules | Exporting functions, classes, and values |
10. | json | Handling JSON passed between JS and Rust |
11. | errors | Creating and throwing errors |
12. | async | Creating and scheduling async background tasks in Node's thread pool |
13. | thread count | Expose the num_cpus Rust library to JS |
14. | fibonacci async task | Computing the nth fibonacci number in Rust and passing the result to JS |
15. | word counting | A word counting demo in Rust and JS with benchmarks |
16. | sharing binary data | Handling binary data passed from Node to Rust |
17. | electron app | A simple electron app using Neon modules |
18. | publishing modules | Using node-pre-gyp to build and publish binaries for multiple platforms |
19. | event emitter | An example of creating an EventEmitter with Neon |
20. | workspace | An example of using Neon in a Cargo workspace |
21. | Bindgen | Planned |
git clone https://github.com/neon-bindings/examples
cd neon-examples
# Compiling and running a single example:
cd primitives
npm install # OR `yarn`
node ./lib/index.js
# Compiling and running all the examples:
npm install -g lerna
lerna bootstrap
lerna run install
cd primitives
node ./lib/index.js