From node.js to Rust, week 2

Advent of Rust: Week 2 Recap

Week 2 of the Rust guide for node.js and JS/TS developers

Jarrod Overson
2 min readDec 16, 2021


The second week of the Advent of Rust series goes deeper into Rust and helps port your logic from JavaScript.

Day 7: Syntax & Differences Between Rust and JavaScript

Day 7 goes over the some of the Rust-specific syntax that will get in your way. We also introduce Vectors and double-ended queues as replacements for JavaScript arrays.

Day 8: From objects and classes to HashMaps and structs

Day 8 maps use cases for JavaScript Objects, Maps, and classes to Rust’s HashMaps and structs. We also start the Traffic Light example which extends over the next three days.

Day 9: Class Methods for Rust Structs (+ enums!)

Day 9 adds behavior to data with impl and touches on how Rust enums are vastly more capable than anything you’ve used in the JavaScript world.

Day 10: From Mixins to Traits

Day 10 clarifies some of the early frustrations people experience when dealing with Rust’s traits, Rust’s answer to reusable behavior.

Day 11: The Module System

Day 11 takes Rust’s module system and decomposes it into the parts that matter, specifically how exactly do you import code from one file into another?

Day 12: Strings, Part 2

After six days we have finally gone through enough to tackle the rest of the Stringproblem. Day 12 goes over how to accept borrowed and owned strings in as pleasant a way as Rust allows.

Day 13: Results & Options

The last day of our second week goes over two of Rust’s most common data structures, the Result and the Option. Both of these enums help Rust represent problems and nothingness without throwing errors or passing around nulls and undefineds.

Next week:

The next week worth of posts will go over closures, error handling, Rust’s lifetimes, Arrays, loops, and iterators. Subscribe to the RSS feed to get notified of posts as they come.

For updates or discussion, follow me on Twitter at @jsoverson, @vinodotdev, or join our Discord channel.



Jarrod Overson

I write about JavaScript, Rust, WebAssembly, Security. Also a speaker, O'Reilly Author, creator of Plato, CTO @Candle