Learn More Rust: Extra

Once you went through the resources in the previous two chapters you might want to start working on a real project to start applying and solidifying your knowledge. A classic way to do this is by porting a small specialized codebase from one language to Rust, keeping in mind to not 1-to-1 map the lines of code but to instead focus on porting the logic with the "Rust way to do things" in mind.

Should you want some inspiration or a more guided approach, here are some resources that could help you out with this extra optional, but recommended step:

  • Command-Line Rust: build a cli tool such as grep in rust, using test driven development (TDD), all to learn Rust
  • Rust Application Books - The Little Book of Rust Books: lists a lot of different books, including ones that allow you to develop small projects using Rust, usually in a well guided fashion;
    • You might find https://archive.is/acQA2 an interesting companion article as it gives some (common) ideas that you can apply to the CLI tool you're building;
    • Introduction - PNGme: An Intermediate Rust Project is an especially fun small project. It allows you to apply the knowledge that you learned above in a very narrow program, that is for once not network related. At the end you'll have a cli tool that allows you to encode and decode "hidden" messages in a PNG image;

Was it always your dream to make your own Game? And do you also want to learn Rust?

https://bfnightly.bracketproductions.com/webbuild.html might be the free online guide for you!

In this tutorial you go through the entire process of building your own game and compile it to WASM so that you can play it directly from any modern browser!

If you like this tutorial and other material by Herbert Wolverson you can also go over to https://pragprog.com/titles/hwrust/hands-on-rust/ and buy his book, available as paperback and ebook.

Most pragmatic commercial Rust books cover Macros only as much as you need to know about them:

  • What are macros?
  • How do they work?
  • How to read them?
  • And some books might even teach you about cargo expand (the tool that will help you with reading macros);

When the day comes that you do feel ready to learn about Macros, here a list of extensive resources all about macros:

đź”— Rust Power Tools (MEAP) (By Manning Publications Co.)

A great book to help you with supercharging your code with macros—the real power tools of the Rust programming language!

This book focuses mostly on Procedural macros, but does give a quick intro of declarative macros as well (macro_rules!).

Rust Power Tools is a comprehensive guide to creating macros in Rust. You’ll start your journey with declarative macros, then quickly move on to the powerful procedural macros to build your own domain-specific language. Learn how to create public fields, work with custom attributes, integrate your macros with other crates, write effective tests to ensure your macros are reliable and bug-free, and even share your macros with other developers.

If you have a lot of free time at your hand and you want to build something really cool that is totally useless, here are some more ideas:

Seriously though, do not consider the above recommended or mandatory in any way. If you however really like to develop stuff and you do like to do it extensively in your free time, then, and only then, I do believe that the above are a great way to really solidify your current Rust knowledge and give yourself a great (pragmatic) foundation.

At this point you might also be ready to start reading alternative — community driven — learning resources on foundational Rust knowledge. With such content you do however always need to be careful as they might contain mistakes, not well rounded or closed opinions. An example of possible valuable learning resources are the following blog series about the Rust type system:

More parts to come as well.

For the brave among you with the time for it, learn to build your own Operating System (OS) using Rust: https://os.phil-opp.com/

Code like a pro in Rust

At this point of your Rust learning journey you've come a far way already, relatively speaking. Perhaps you want to shortcut, at least for now.

If so, the still to be published "Code like a pro in Rust" book might be enough for you to quickly get from beginner to advanced Rust programmer.

A Crust of Rust

Once you get at this point you are around the level of a beginner or intermediate Rust programmer. At this point you could already start to tackle stuff like "Rust for Rustaceans" of step (6). However it might be a bit much.

Therefore while you go through the next couple of sections it could be helpful to now and then (e.g. while washing dishes or instead of Netflix) an education Rust code video. In the appendix at the bottom of this page there a couple of such suggestions.

Particular to this context you might want to save the "Crust of Rust" playlist. Each video will go over a specific topic, e.g. Lifetimes, macros, Atomics, … No need to watch them one by one, feel free to jump to them in whatever orders and only those that interest you (which is the same tip that I can give for the "Rust for Rustaceans" book).

API Design

Designing APIs is a big part of being a Rust programmer, any programmer really. Once you start to get comfortable enough in Rust or start building your own public crate, it is a topic you'll want to invest in.

A good starting point is the API Guidelines which are a set of guidelines that are meant to help you design good APIs. They are not meant to be followed blindly, but rather to be used as a reference to help you make the right decisions.

A next and continuous step is to read blog posts and watch videos about API design. The Rust newsletter often has an article listed in its weekly edition. But other platforms such as HackerNews will have interesting Rust articles pop up as well. https://sabrinajewson.org/blog/errors is for example a great article talking about one might to give errors as much love as the other parts of the API, and also talks about why crates like thiserror might not be that great. All in all, similar to other parts of your continuous Rust learning journey, you'll want to remain critical and open to new ideas and see what works for you and what not.

If you are however still in the camp of thiserror, you might be able to make good use of blog posts such as https://determinate.systems/posts/instrumenting-axum that guide you through adding instrumentation to your Axum based web service, using thiserror among other excellent crates such as tracing. A great read, especially if you're not that experienced with instrumentation that goes beyon the basic single line logs.