Calling Rust code from Node.JS - Why and How | Rust Lang | JavaScript

  Рет қаралды 8,871

Chris Hay

Chris Hay

Күн бұрын

Пікірлер: 34
@jam_sessions6814
@jam_sessions6814 Жыл бұрын
This is super cool!! Lets go NodeJS * Rust here we go
@Ab-cj6gl
@Ab-cj6gl 2 жыл бұрын
awesome video, i've been learning how to code for 8 months now (just JS). i'm new to this world but i'm fascinated with Rust. i'll def learn it after i get a dev job i also loved the style of the video
@chrishayuk
@chrishayuk 2 жыл бұрын
awesome.. glad you're enjoying. as i said, i believe in a hybrid world, so knowing both will help you
@fluffyunicorn7155
@fluffyunicorn7155 2 жыл бұрын
FFI = Foreign Function Interface
@chrishayuk
@chrishayuk 2 жыл бұрын
Yeah I’m not sure why I kept messing that up
@Saeid-Za
@Saeid-Za Жыл бұрын
Could you please do a video on performance benchmark of calling same functionality from WASM, NAPI & Node addons?
@MiniKodjo
@MiniKodjo Жыл бұрын
cool, but the real thing wouldnt to build rust to webassembly and import wasm module in nodejs?
@dragonmax2000
@dragonmax2000 2 жыл бұрын
Very nice tutorial. Did not think I can do that. :)
@chrishayuk
@chrishayuk 2 жыл бұрын
glad it was useful
@martynclarke8400
@martynclarke8400 Жыл бұрын
So I was considering learning c++ for node addons, mainly for the more cpu intensive processes. But I heard about rust and have started doing some digging. Im struggling to find reasons why I would choose anything but rust at this stage. Thanks a lot for this video
@chrishayuk
@chrishayuk Жыл бұрын
Yeah, rust is your best bet for the stuff you’re trying to do
@user-ur4ev7vl6c
@user-ur4ev7vl6c 2 жыл бұрын
So useful, thnks very much!)
@chrishayuk
@chrishayuk 2 жыл бұрын
Glad it was helpful!
@57Javier747
@57Javier747 2 жыл бұрын
Thanks sir! Very helpful!
@chrishayuk
@chrishayuk 2 жыл бұрын
welcome.. glad it was useful
@matthewturner6644
@matthewturner6644 2 жыл бұрын
Great video. Any references on how to do this natively as opposed to with ffi?
@chrishayuk
@chrishayuk 2 жыл бұрын
Good shout!!! Let me take a crack at that
@MrArkus90
@MrArkus90 Жыл бұрын
Thanks for the video, it gives some starting point. But I wonder, how do I share a custom struct (and it's methods) to Node? I would like to have my common code be usable both on Node and Rust, so I don't want to "rewrite" code just to work with Node
@PouyaAtaei
@PouyaAtaei 2 жыл бұрын
Great video, thanks.
@chrishayuk
@chrishayuk 2 жыл бұрын
Glad you liked it!
@rocketsloth3050
@rocketsloth3050 2 жыл бұрын
Really enjoyed this video. You explain things in such a good way. I have some questions about some coding issues (cause I’m only about 5 months into coding) that I would like to get your input on. Where would be the best way to get ahold of you?
@chrishayuk
@chrishayuk 2 жыл бұрын
glad you're enjoying and the vids are helpful. feel free to dm me on twitter
@sortof3337
@sortof3337 Жыл бұрын
It did not work for me. :( I am literally doing the same thing but getting symbol not found when napi tries to load funcs. I am on linux.
@ChumX100
@ChumX100 2 жыл бұрын
I can see the benefits of targetting WebAssembly for use in the browser, where only JS is available. But in a server environment, where you can run native code, wouldn't it be simpler and more maintainable to just use Rust if you need the performance it offers? It would be nice to explore the scenarios where Node provides advantages over Rust, in order to justify the "hybrid server" vision.
@chrishayuk
@chrishayuk 2 жыл бұрын
great comment.. i discuss some of this in this vid here.. kzbin.info/www/bejne/oqikgpx7bMeIY5o quick version is.. sandboxing and hosting code on others behalf such as sandboxes.
@ChumX100
@ChumX100 2 жыл бұрын
@@chrishayuk I see now. Indeed, very important use cases. I'm a very optimistic about edge computing as a cloud alternative, but hadn't yet thought about eCommerce companies and banks allowing users to run sandboxed code in their platform. That really opens up so many possibilities....
@chrishayuk
@chrishayuk 2 жыл бұрын
@@ChumX100 yeah it's pretty exciting. edge running wasm is gonna be big as is e-commerce etc
@11WicToR11
@11WicToR11 2 жыл бұрын
your point makes sense, but imagine how many projects are written for node at this point. There for sure are some new features that wouldnt have good enough performance, but simply getting this interface where result can be returned is all you need. The thing i dont understand is how is this better from running external command (in rust) and collecting its output from stdout? I mean that one requires parsing but this video also requires to specify return types and all, theres a little difference, right?
@flat-line
@flat-line 2 жыл бұрын
Hi cris, quality content, thanks. do you aware deno is written in rust , and you can extend it with native rust code also !
@chrishayuk
@chrishayuk 2 жыл бұрын
yep. i plan to do a video on this soon, and do a comparison to this one :D. great comment and glad you're enjoying
@flat-line
@flat-line 2 жыл бұрын
@@chrishayuk looking forward to that video, cheers :)
@DavidAlsh
@DavidAlsh 11 ай бұрын
Can't seem to find your video on using wasm with Node.js - any chance you could share that? EDIT: nevermind - kzbin.info/www/bejne/d53Wepukp7aCb6M
@chonkey
@chonkey 4 ай бұрын
disliked
@chrishayuk
@chrishayuk 3 ай бұрын
appreciate the feedback
Getting Started with WebAssembly (WASM) with Rust Lang
33:10
Chris Hay
Рет қаралды 11 М.
Why is the JavaScript ecosystem switching to Rust?
48:08
chris biscardi
Рет қаралды 130 М.
The FASTEST way to PASS SNACKS! #shorts #mingweirocks
00:36
mingweirocks
Рет қаралды 17 МЛН
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 53 МЛН
Is JSON Blazingly Fast or...?
9:57
ThePrimeagen
Рет қаралды 192 М.
Rust is not a faster horse
11:37
No Boilerplate
Рет қаралды 325 М.
Is TypeScript (NodeJS) Faster than Go?? |  A server comparison
9:54
ThePrimeagen
Рет қаралды 220 М.
Rust multi-threading code review
12:13
Tantan
Рет қаралды 197 М.
Rust is the Perfect language For You
13:13
CoderOne
Рет қаралды 64 М.
Rust vs 7 Other Languages You Probably Haven't Tried
8:55
Code to the Moon
Рет қаралды 76 М.
Why JavaScript Devs are Switching to Rust in 2024
10:35
warpdotdev
Рет қаралды 257 М.
TypeScript Origins: The Documentary
1:21:36
OfferZen Origins
Рет қаралды 287 М.
The FASTEST way to PASS SNACKS! #shorts #mingweirocks
00:36
mingweirocks
Рет қаралды 17 МЛН