Images in this article generated by the Author using mage.space

Member-only story

More fun with Rust — WebAssembly

My first WebAssembly app in six little steps

Dave Sag
6 min readSep 5, 2023

--

First I create a simple WebAssembly “Hello World” application using Rust, explaining how to set up your development environment, write some Rust code, and then compile it to WebAssembly.

Then I follow up with a small function that uses Wasm to resize an image.

See Source Code: https://github.com/davesag/image_resize_and_combine where I’ve continued to experiment after finishing this article.

See also: https://davesag.medium.com/rust-from-a-typescript-developers-perspective-57ab633c4519

Background: As a JavaScript / TypeScript dev, why learn Rust or WebAssembly?

WebAssembly is a browser based low-level operating system that lets you write code in a handful of languages and compile it into a low-level universal browser-based virtual machine’s code that runs as close to bare-metal as the browser is capable. You can leverage multi-processor threading, do background tasks, and you get to code in Ruby which is fast becoming my new joy.

I’ve been a JavaScript developer since the 1990s and regularly railed against TypeScript until suddenly I didn’t. I drank the Kool Aid and suddenly found myself firing up a TS…

--

--

Dave Sag
Dave Sag

No responses yet