Questions tagged [neon-bindings]

9 questions
3
votes
0 answers

how to pass a class to renderer process using context bridge

I have a nodejs module i have created using neon rust, that uses JsBox, and queue async feature. I also have an electron react app, my current mainjs looks like this: function createWindow() { const mainWindow = new BrowserWindow({ …
Vypa
  • 31
  • 2
1
vote
1 answer

Do Rust addons in node make sense for compute heavy workloads?

So i am a noob when it comes to Rust or creating Node.js addons with it, so i started exploring Neon example here I modified it a little to see how "compute bound cpu tasks" like nested for loop return any optimization if i write in Rust or JS by…
Laukik
  • 424
  • 4
  • 13
1
vote
0 answers

Passing a neon::Context into an internal function

I've got an exported-to-NodeJS Rust function that does something. Now, I want to extract part of that function into its own function (creating a JS object), so that I can reuse that logic in another, new exporter-to-NodeJS Rust function. However,…
womble
  • 12,033
  • 5
  • 52
  • 66
1
vote
1 answer

How to get stack backtrace from Rust addon to Electron app

I am using neon to create a Rust addon to an Electron app. It's basically working, but every time there's a crash I get an error message like "attempt to divide by zero" but no location, and as the code base grows it gets increasingly onerous to…
AmigoNico
  • 6,652
  • 1
  • 35
  • 45
1
vote
1 answer

performing an async task using neon while passing data from nodejs to rust

I want to use neon to perform an async task from nodejs to rust. I want to call a function from nodejs with some data performAsyncTask(data, (err, result) => {}) and get back a result once rust has finished performing the task. I looked at a basic…
Timur Ridjanovic
  • 1,002
  • 1
  • 12
  • 18
0
votes
1 answer

Neon bindings example with RefCell not working

I'm trying to figure out how to use native Rust modules in NodeJS using the Neon crate. To get started I was following an example using RefCell to make it possible to call mut functions on an object through JavaScript. However, when I copy the…
0
votes
1 answer

can't import JsBox from Neon::types

For some reason, I can't use JsBox. I am using the 0.8.2 crate I get the flowing error unresolved import neon::types::JsBox
Nadsah
  • 109
  • 1
  • 9
0
votes
0 answers

Error when using a native library created with Rust in an electron app

Problem I get an error when I run the following code. // In Rust pub fn play_music() { let host = cpal::default_host(); let mut devices = host.output_devices().unwrap(); let device = devices .find(|d|…
Romira
  • 1
-1
votes
1 answer

npm t killed and git diff not working because of an added addon.node

For the past couple of days I have been struggling with this issue. I have this addon.node that is built using neon-cli trough npm. once this file is introduced to the git environment git diff stops working and the npm test gets killed before…
Nadsah
  • 109
  • 1
  • 9