Sponsored by the Internet’s Breakfast Club, Mozilla, Rust is a new programming language rising in popularity. I recently started developing in Rust and I wanted to share my experience, especially as a relatively new developer, in learning the language and releasing my project as a Rust crate.

Over the past two months, I worked on a feature for Project Fluent. My feature was needed in the Rust implementation of Fluent and was published as a Rust crate, making my code available to the entire Rust community. Completing this project brought me a great sense of satisfaction, and having contributed a fundamental internationalization crate to the Rust ecosystem is possibly the biggest milestone in my career as a developer. I documented the crate in this blog post on the Mozilla localization blog.

Trial by Rust

Although I have been programming for several years, I come from an unconventional background when it comes to programming (read: I don’t have a CS degree). that being said, I had many lessons to learn in the early stages of using Rust, not unlike Daniel-san from the Karate Kid. Instead of wax on, wax off, I had to learn things like strong typing, borrowing, lifetimes, and traits.

The features of Rust that a developer finds difficult to understand will vary from person to person, depending on their strengths and weaknesses. However, regardless of your ability, the information you need to start programming in Rust is available in the Rust Book.

The Rust book is both a guide to learning Rust and the central source of Rust documentation. The Rust Book is very well-written and I found the chapters and accompanying examples in the book to be very helpful.

In small details news: I personally love the Rust theme for the Rust Book. If you’re reading this and you know about a Rust theme for Sublime Text, lmk.

At first I created new cargo projects for the examples in the book (which helped me understand what a Rust project looks like structurally) but once I got the hang of things I found the Rust Playground to be more convenient for completing the examples.

The Rust Playground is cool because it supports the 100 most popular crates—which means most crates you need will be available—and it makes it really easy to share your code—which is really helpful if you have a Rust expert to send your broken code to… but I wouldn’t know anything about that (/s).



While the Rust Book was a very pleasant experience, Rust API documentation was more of a struggle. This documentation comes in handy when using a crate, or in some cases would come in handy if there were any documentation. I’m being too critical—the documentation is complete, but the accompanying prose can be quite sparse, making it difficult for a Rust newb like me to utilize the perfectly good code. And, as we all know:

The real challenge here may be getting a less-experienced developer like me to understand the technical format of the documentation and syntax-oriented examples without much of a “plain English” translation.

I’m hesitant to criticize Rust for the frustration with this documentation because the problem might have been my lack of experience. Today, I can typically find the information I need from the docs, but I don’t consider myself I pro by any means.

To be fair about the sparse documentation, the first issue posted to my crate was “Example in documentation could use more comments.” Let’s make a deal, Rust developers: I’ll work on my documentation, you work on yours, and together we’ll make the world a better place.

The essence of Rust

Prior to learning Rust, I had developed almost entirely in Python. Python is a yes-man. You tell Python what you want and Python will quietly agree without question (for better or for worse in my experience 😅 ).

Rust, on the other hand, is designed specifically to be “safe, concurrent, and practical.” This means that Rust isn’t a yes-man. Rust speaks up when your code doesn’t abide by the logic of its design. You could say that Rust is a question-asking, fact-checking millennial of a programming language.

I realized how useful Rust’s error messages were while trying to compare a float to an int (think: apples and oranges). I wanted to know if two variables represented the same number value, but Rust’s emphasis on safe code prevented me from comparing two things that weren’t the same type.

Rust boolean values: true

false

wtf are you doing? — Uncle Nacho, duh (@UncleNachoDuh) July 12, 2018

This may seem annoying to some, but I rather enjoy Rust’s opinionated nature. Perhaps what I like most about Rust is that, although its opinions and the quantity thereof may be overbearing, it provides constructive criticism as much as possible. Error messages often give recommendations for solving the issue with you code or at least point you to problematic points of interest.

I love that the Rust community takes diagnostics issues so seriously. It's so nice working in a language with great error messages that are constantly improving. 😁 — Sunjay (@Sunjay03) August 12, 2018

Rust error messages don’t only point out what’s wrong with your code but tries to recommend the code snippet that is missing. For a Rust learner like myself, these kinds of error messages are very helpful with both syntax and logic errors.

It’s also possible to get Rust’s opinion before you even ask for it (just like real life)! You can get Rust support for many text editors you may be using at Are We (I)DE Yet? and, for some editors, Rust will tell you what you did wrong, even before you compile among other helpful Rust tools.

cargo publish is forever

I wish I could speak more to the utility of key Rust components like cargo and rustup , but the truth is either

I had a ton of help and didn’t have to deal with the hard stuff These tools were so easy to use that I didn’t even notice how easy it was

or a combination of the two. My money is on the combo 🍔🍟 🥤.

However, I did publish a real-for-real crate and the scariest part of that is knowing that cargo publish is forever. I get a shot of adrenaline each time I run the cargo publish command because I know any mistakes are permanent (at least for that release) and, more importantly, what if I don’t like the name I give my crate? Fortunately, I haven’t heard any big complaints about my code (although, I seriously did get a complaint about the crate name) (ha).

When I finished writing my crate, I found it incredibly easy to write the documentation. cargo doc is hands down one of my favorite cargo features. I was able to write my own docs just fine, but I wish the Rust book explained the different types of inline comments more clearly.

At the end of the day, the permanence of cargo publish may be daunting, but it’s also pretty cool to have a permanent place in Rust history. In fact, I wish I knew what crates the Rust Team needed/wanted that I could contribute to the ecosystem. I understand that scoping projects for developers with limited skill sets like me is difficult, but as a new Rust developer I want to know what meaningful opportunities there are to move the language forward, even if I’m just a script-writing kiddo.

The Rust of the story

All being said, this was my experience with learning the language, and it will be different from others’.

I think the Rust Team has done a great job of making Rust palatable to a new user. Rather than simply preventing unsafe and inefficient code, Rust encourages and facilitates safe and efficient code and the implementation of that feels and looks great.

Of course, there is room for improvement, and I think the rate at which Rust is growing indicates that improvement is inevitable. I hope to be part of that improvement and I’m happy to share my experience as a Rust newb as a first step.