Honest question: Why would someone use Node instead of a Rust web framework when writing part of the code in Rust anyway?
Neon: Node plus Rust
61–70 of 71 posts
Re: Neon: Node plus Rust
#62Earlier quoted context omitted.
If the goal is having a fast "business-rules engine" coupled to a pretty HTML5-based app-wrapper, one of my own projects is to combine Electron with the Erlang VM. Rather than trying to go whole-hog on linking the two worlds together at a process level, I've just embedded an Erlang release into the Electron package, which decompresses itself to the user's Library/APPDATA dir on Electron startup, transparently registe…
Give me this but with Elixir and Im sold.
Re: Neon: Node plus Rust
#63Honest question: Why would someone use Node instead of a Rust web framework when writing part of the code in Rust anyway?
Re: Neon: Node plus Rust
#64Honest question: Why would someone use Node instead of a Rust web framework when writing part of the code in Rust anyway?
Because rust isn't web yet: http://arewewebyet.com .
Re: Neon: Node plus Rust
#65There's an API thing from the JS side I don't understand, and I didn't find anything documentation-wise (maybe it's just because I haven't had my coffee yet): require('neon-bridge').load() So this loads... which rs file, exactly? Where do I specify the Rust file to be loaded? Or is there just a single entry point and you're supposed to have one singular Rust module that is named by convention?
The line you cited is automatically locating the .node file, loading it, and returning the module object associated with it.
On IRC a couple people have been questioning this part of the API, suggesting that just using the standard npm module `bindings` might be better. It's a reasonable idea and I'll probably open a discussion in a GitHub issue.
Re: Neon: Node plus Rust
#66There's an API thing from the JS side I don't understand, and I didn't find anything documentation-wise (maybe it's just because I haven't had my coffee yet): require('neon-bridge').load() So this loads... which rs file, exactly? Where do I specify the Rust file to be loaded? Or is there just a single entry point and you're supposed to have one singular Rust module that is named by convention?
Rust is a compiled language, so the JS files don't directly load a .rs file but instead they load a native Node extension, i.e. a .node file, which is generated by compiling and linking the Rust sources. (The node-cli tooling automates the whole build process.) The line you cited is automatically locating the .node file, loading it, and returning the module object associated with it. On IRC a couple people have been…
My question is/was, given two or more modules written in Rust, how do I address and require them by name? Due to its naming I assumed "neon-bridge" would be the glue that handles this. Given the fact that you can require .node files directly, it was not clear to me that "neon-bridge" is just the name of an example module (or is it?).
Re: Neon: Node plus Rust
#67Earlier quoted context omitted.
Rust is a compiled language, so the JS files don't directly load a .rs file but instead they load a native Node extension, i.e. a .node file, which is generated by compiling and linking the Rust sources. (The node-cli tooling automates the whole build process.) The line you cited is automatically locating the .node file, loading it, and returning the module object associated with it. On IRC a couple people have been…
I realize that Rust is a compiled language, that's not the issue. The syntax somehow suggested to me the modules could be compiled on demand, but that is not the issue either. My question is/was, given two or more modules written in Rust, how do I address and require them by name? Due to its naming I assumed "neon-bridge" would be the glue that handles this. Given the fact that you can require .node files directly, i…
So neon-bridge is a utility npm package I published that automates loading your Neon project (so it's not the name of an example module). And the expectation is that you only have one Rust package ("crate" in Rust parlance) per Node package, which is why you don't need to pass it the name of anything -- it's looking for _the_ native module in the package, as opposed to _a_ native module.
However, that single Rust crate may have multiple modules in its implementation. They live in the src/ directory of your Neon project and are picked up by the Rust compiler and build tool.
And yes, deeeeefinitely need to get some docs going... :P
Re: Neon: Node plus Rust
#68Earlier quoted context omitted.
I realize that Rust is a compiled language, that's not the issue. The syntax somehow suggested to me the modules could be compiled on demand, but that is not the issue either. My question is/was, given two or more modules written in Rust, how do I address and require them by name? Due to its naming I assumed "neon-bridge" would be the glue that handles this. Given the fact that you can require .node files directly, i…
Ah, I see! So neon-bridge is a utility npm package I published that automates loading your Neon project (so it's not the name of an example module). And the expectation is that you only have one Rust package ("crate" in Rust parlance) per Node package, which is why you don't need to pass it the name of anything -- it's looking for _the_ native module in the package, as opposed to _a_ native module. However, that sing…
Re: Neon: Node plus Rust
#69Earlier quoted context omitted.
Because rust isn't web yet: http://arewewebyet.com .
That site is very out of date. We've been trying to get it fixed (as none of us control it), but we haven't been able to so far. :(
Re: Neon: Node plus Rust
#70Earlier quoted context omitted.
Ah, I see! So neon-bridge is a utility npm package I published that automates loading your Neon project (so it's not the name of an example module). And the expectation is that you only have one Rust package ("crate" in Rust parlance) per Node package, which is why you don't need to pass it the name of anything -- it's looking for _the_ native module in the package, as opposed to _a_ native module. However, that sing…
Cool, thanks for clearing that up. And thanks for working on this, I know with the questions it can sometimes seem like it's not appreciated... :)