DEV Community

Cover image for 🦕🦀Writing WebAssembly in Rust and running it in Deno!

🦕🦀Writing WebAssembly in Rust and running it in Deno!

Michael "lampe" Lazarski on May 17, 2020

Requirements You need to have to follow tools installed on your machine: rustc rustup cargo deno These are standard things you usual...
Collapse
 
terkwood profile image
Felix Terkhorn

Perfect timing 🌟

Collapse
 
lampewebdev profile image
Michael "lampe" Lazarski

Nice! Hope it will help 😄👍

Collapse
 
terkwood profile image
Felix Terkhorn

Absolutely!! I need to dig in on your finer grained details here, but this effort is on my shorter lists 📃 🏁 Thank you

Thread Thread
 
lampewebdev profile image
Michael "lampe" Lazarski

Glad if I can help at least a little bit 😄👍

Thread Thread
 
terkwood profile image
Felix Terkhorn • Edited

I followed along and it was completely painless!

Added a build script written using DENO to wrap up your two example commands with a pleasantly chmod 755'd interface.

Thanks again for contributing this!

(I keep most of my work public, but declined to put a license on my repo, since I didn't see one posted on yours. Didn't wanna step on your toes! Cheers)

Thread Thread
 
lampewebdev profile image
Michael "lampe" Lazarski

Nice!

I will add a MIT Liecence now ;)
I always forget that :D

Collapse
 
waylonwalker profile image
Waylon Walker

The wasm support in deno looks top notch.

Collapse
 
lampewebdev profile image
Michael "lampe" Lazarski

Indeed it is super easy :D

Collapse
 
ben profile image
Ben Halpern

Dang, this is super interesting

Collapse
 
terkwood profile image
Felix Terkhorn • Edited

Yah, thinking about optimized hotspots here 🌟

Our hope is that the dev flow with Deno is significantly faster than rust, in terms of satisfying the compiler's requirements and (we think) actually waiting for compilation to finish. Rust compilation is very slow, especially in release mode.

Perhaps there's a nice use case for quickly writing a bunch of typescript and then swapping out rust in targeted sections. At least in theory.

The wasm support in Deno prevents this from feeling like a snobbish hack!

Collapse
 
lampewebdev profile image
Michael "lampe" Lazarski

Thanks Ben 👍😄

Collapse
 
shaijut profile image
Shaiju T

😄 Nice, I have not learned Node.js yet, So were should I start Node.js or Deno ?

Collapse
 
lampewebdev profile image
Michael "lampe" Lazarski

Hey,
They share a lot of concepts and a lot of ideas and also code.
So I would start with the nodejs basics because you just have more learning material out on the internet but I would learn the basics so you can easy transfare your knowledge later to Deno.

Collapse
 
reselbob profile image
Bob Reselman • Edited

This is a great intro to using Deno and WebAssembly. It makes the basic concepts very easy to understand. Thanks for making this contribution.

Collapse
 
lampewebdev profile image
Michael "lampe" Lazarski

Thank you 😄👍

Collapse
 
reselbob profile image
Bob Reselman

You inspired me! Thus I transcribed your lesson into a Katacoda scenario.

katacoda.com/reselbob/scenarios/de...

Of course, I give you full credit for the inspiration.

Collapse
 
shaijut profile image
Shaiju T

Hi typo in title, should be running isn't?

Collapse
 
lampewebdev profile image
Michael "lampe" Lazarski

Thanks, changed it.

Collapse
 
chadbr profile image
chadbr • Edited

Silly question — how do you do two functions? Keep adding to the wasmInstance.exports definition? Is it doing name matching? Ordered by function order in the Rust file?