Perhaps more important than a crash course tutorial in Rust is learning how to learn Rust. You can sit back and listen to the tutorial and maybe you will learn a little something. Learning how to learn Rust will put you on a path that will lead to eventual mastery. It is up to you!
Big, bloated IDE's can actually be really helpful in learning Rust. IDE support is part of the core Rust project, and it is already getting really good. Much more than just syntax highlighting, an IDE like IntelliJ will integrate with the compiler and show you type hints, compiler check errors, and all sorts of good stuff inline.
- Google: Rust (your favorite IDE)
- Install Rust support
- Install TOML support, which is often separate from Rust support (TOML is the config file format that Rust uses)
- ...wait...
- Be amazed at all the helpful auto-complete, etc. that turns on. Yay!
- Customize your editor to your liking.
You are always going to have questions. Know how to find the answers.
- If it is about something the standard library, then Google:
rust std (thing you want to find)
- For example, can't quite remember what that method on
Vec
was? Googlerust std Vec
- For example, can't quite remember what that method on
- There is a very welcoming Rust Community out there that you can
communicate with. See the link above for:
- Forums
- IRC channels
- StackOverflow topics
- News (The weekly newsletter is seriously fantastic)
- YouTube channel
- User Groups and Meetups
- Where to find and communicate with all the core Rust Teams
Code something. Don't just sit and watch the tutorial. Try stuff out!
- Do the stuff in the tutorial!
- Don't be afraid to just
cargo new blah
and write a 5-line throwaway program to try something out. - Start an interesting little project
- If you get stuck, or the project gets boring...no worries! Just start another interesting little project...
- Find an existing project that looks interesting
- Try it out
- Try to contribute a bug fix or feature
- Rewrite some existing little project in Rust (in a new project)
- Compare the results
- What did you like better about Rust?
- What did you like better about the other language?
- Compare binary size, memory usage, speed, etc.
- Write a blog post about your experience!
There are tools that help you learn as well.
- Clippy is a super-amazing linter. It will tell you how to change working code into idiomatic and high-performing code.
- rustfmt will format your code according to Rust style guidelines. There's only one set of Rust style guidelines...so there's nothing to argue about! Unfortunately, the project is right in the middle of a major overhaul...so it pretty much only works if you're using the nightly compiler (sigh).
Long-format reading is really interesting and informative. You will learn some things plowing through a comprehensive book that you would never have encountered during years of reading random bits of the standard library reference. I found these books especially useful and high quality:
Educational
- The Rust Programming Language, aka "The Book" - the official free online book about the language. I have read the first and second edition, and they're both great. At this point in time it probably makes more sense to go straight to the second edition.
- Programming Rust - The O'Reilly book by Jim Blandy and Jason Orendorff. Fantastic book focused on using the Rust language. Much longer and more in depth than you can get elsewhere.
Informational
Random References (Things the Tutorial Didn't Specifically Cover)
- TOML Format - the config file format Rust uses
- Semantic Versioning and Cargo's Version Field Rules
- String Formatting -
print!()
,println!()
,format!()
, etc. and how to deal with the format string. - Non-Lexical Lifetimes (NLL) - What it is and how close it is to becoming real
- Firefox has over a million lines of Rust Code
Fundamental Learning References (Things the Tutorial Covered)
- Cargo and dependencies
- Variables, Mutability, and Shadowing
- Functions - fn
- Modules and pub and use
- Scalar Types - Integers, Floating-point, Boolean, Characters.
- Compound Types - Tuples, Arrays.
- Control Flow - if, while, for
- Threads and channels
- Ownership and Scope
- References & Borrowing
- Common Collections: Vectors, Strings, and Hash Maps