From Javascript to Rust



1.1. A guide to Rust from a node.js developer’s perspective.
Each chapter will take concepts you know in JavaScript and node.js and translate them to their Rust
counterparts. The first chapters start with the basics, like getting set up with Rust via a tool similar
to nvm (rustup), using the package manager (cargo), and setting up VS Code. Later chapters go over
language gotchas, how to perform common JavaScript tasks in Rust, and we’ll finish up by touching
on solid dependencies to start adding to your projectss.

1.2. Wait, why does anyone need to learn anything but JavaScript?
I love JavaScript. I’ve been coding JavaScript it since I first saw it in Netscape. I’ve written more
lines of JavaScript than any other language. I’m a fan, but I know where the language falls short. It’s
fast, but not that fast. It’s easy to write, but easy to screw up. Large projects become unwieldy fast.
TypeScript helps scale JavaScript but it adds its own complexity and still doesn’t make anything
faster. Server-side JavaScript relies on node.js which is common but not ubiquitous. If you want to
distribute something self-contained, there aren’t great answers.
When you start stretching passed what JavaScript is best at, it’s helpful to have another language to
turn to.

1.3. Why Rust?
You could use C, C++, C#, Go, Java, Kotlin, Haskell or a hundred others. Rust is notoriously difficult
even for system programmers to get into. Why bother with Rust? Think about your languages as
tools in your toolbox. When you fill your toolbox, you don’t want 10 tools that solve similar
problems. You want tools that complement each other and give you the ability to fix everything an
anything. You already have JavaScript, a developer super-tool. It’s a high level language that’s good
enough to run just about everything everywhere. If you’re picking up a new language, you might as
well go to the extreme and pick a no-compromise, low-level powerhouse.
Also, WebAssembly.
Rust’s tooling and support for WebAssembly is better than everything else out there. You can
rewrite CPU-heavy JavaScript logic into Rust and run it as WebAssembly. Which basically makes
you a superhero. With JavaScript and Rust, there’s nothing you can’t handle.

1.4. How to use this book
This book is not a deep, comprehensive Rust tutorial. It’s meant to bootstrap experienced
programmers into Rust. We’ll take common node.js workflows and idiomatic JavaScript and
TypeScript and map them to their Rust counterparts. This book balances technical accuracy with


There are no reviews yet.

Be the first to review “From Javascript to Rust”

Your email address will not be published. Required fields are marked *