Skip to content

Latest commit

 

History

History
116 lines (92 loc) · 7.08 KB

HowToLearnRust.md

File metadata and controls

116 lines (92 loc) · 7.08 KB

How To Learn Rust

Perhaps more important than a crash course tutorial in Rust is learning how to learn Rust. Learning how to learn Rust will put you on a path that will lead to mastering the subject.

IDE / Editor

Though not always as light and nimble as a dedicated editor, an IDE can be really helpful in learning Rust. IDE support is part of the core Rust project, and it works well. Much more than just syntax highlighting, an IDE like VS Code or IntelliJ will integrate with the compiler and offer type hints, display errors, link to documentation, offer code completion, and much more.

  • Google the terms: rust (name of the IDE or Editor you use)
    • Need a suggestion? Visual Studio Code and IntelliJ are both great choices (and there are many more...)
    • Find the correct way to install Rust support for your IDE or Editor (it's often a plugin)
    • Install TOML support, which is usually separate from Rust support (TOML is the config file format that Rust uses)
    • ...wait for it...
    • Be amazed at all the helpful auto-complete, etc. that turns on. Yay!
    • Customize your editor to your liking.

Find Answers

You are always going to have questions. Here is how you 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? Google rust std Vec
  • 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), and I'm also quite partial to Rust GameDev news
    • YouTube channel
    • User Groups and Meetups
    • Where to find and communicate with all the core Rust Teams

Play Around

Code something. Don't just sit and watch the course. Try stuff out!

  • Do the exercises!
  • 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!

Tools

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).

Reading

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:

Books

  • Programming Rust, 2nd Edition - The (second edition of the) O'Reilly book by Jim Blandy, Jason Orendorff, and Leanora Tindall. Fantastic book focused on using the Rust language. This is the book I used to learn Rust.
  • The Rust Programming Language, aka "The Book" - the official free online book about the language, though you can purchase a physical copy if you prefer.
  • Rust for Rustaceans - A short, but incredibly action-packed book diving into some advanced topics. I loved this book. Read it after you have a solid grasp of Rust and want to go deeper.
  • The Rustnomicon - The ultimate (unfinished, evolving) book about the deepest mysteries of Rust. Strap in!

Informational

Things we mentioned but didn't cover in depth

More information about things we learned