This post is about my experience learning Rust by solving every CtCI problem live on Twitch, an unfinished project.

Rust logo, courtesy of Mozilla, CC-BY

Rust is a modern systems-level programming language designed with safety in mind. It provides zero-cost abstractions, generics, functional features, and plenty more. I recently embarked on an effort to learn Rust properly, and I wanted to share some of my thoughts.

Until recently, I’d written only a handful of small programs in Rust, and after reading half of “Programming Rust”, I really didn’t know Rust. I figured a good way to get to know the language was to solve all 189 problems from the “Cracking the Coding Interview” book. Not only would I solve them with Rust, but I decided to do it live on Twitch. I’m no stranger to giving tech talks, or coding in front of an audience, but trying to learn a programming language, and explain what I was doing–live for the world to see–was something new for me.

Things started off a bit rough: technical hiccups, stream issues, tooling problems, and I had difficulty understanding the memory paradigm at first. Trying to do that, while also explaining what I was doing to people, was uh…tricky.

It took me about 8 hours to implement a linked list: I recorded two 4 hour streams of myself trying to figure out how to properly use Rc, RefCell, and Box. For a while I felt like I was just banging on the keyboard trying random combinations until something stuck. What’s amazing is that people tuned in to watch. I must have been doing something right.

After a bit of reading offline (and followed the very helpful “Learning Rust With Entirely Too Many Linked Lists” book), and the concepts started to click for me. After finishing my linked list implementation, things got easier.

Linked list in Rust. VSCode has tight integration with RLS

I’m now into chapter 4 of the book, and I feel like I’ve hit my stride. Rust feels natural, productive, and extremely satisfying once it compiles. Rust is strongly typed and provides excellent compiler messages: if you managed to appease the compiler, there’s a good chance your code will work–barring any logic flaws.

One lovely feature of Rust is how helpful the compiler can be. Compiler messages for C++ code, for example, are notoriously difficult to decipher. While Clang has made massive strides with its error messages, Rust’s compiler is another order of magnitude more helpful.

Example of rustc’s error output

I’m going to summarize some of my findings thus far. This is based on my initial reactions, and I acknowledge my lack of Rust expertise, but it may still be interesting for others to see how their experience compares to mine. I woefully admit that I have not thoroughly researched every issue below, so I may have out of date or inaccurate information.

Language: The Good

First of all, kudos to the Rust team and everyone who has contributed to the project. This has been one of the most fun programming language learning experiences I’ve ever had. I don’t know if Rust will capture the mindshare of developers in the same way some other languages have, but I think it’s here to stay. On to the details:

Language: The Bad

Language: The Ugly

Tooling: The Good

Tooling: The Bad

Okay, okay, before I go on about the problems with Rust, we should all acknowledge that this is a work in progress. The Rust tooling has come very far, very quickly, but I think it still has a long way to go. I’m going to highlight a few of the things that need improvement:

Tooling: The Ugly

Libraries: The Good

New York Public Library in 1908, from the Library of Congress

Libraries: The Bad

Libraries: The Ugly

10 different libraries with 2 different versions in the same package

Final Thoughts

Rust is a great language. If programming is something you’re passionate about, please give it a shot. I hope you enjoy it.

Me attempting to have a thought

About me: I’ve been writing code since I was 12 years old, have contributed to a number of different open source projects, and have worked at a variety of companies including Airbnb, Mesosphere, and Citadel. Find me on GitHub at github.com/brndnmtthws, Twitch at twitch.tv/brndnmtthws, or Twitter at twitter.com/brndnmtthws.