HACKER Q&A
📣 fuadnafiz98

How to Learn Rust


I am trying to learn Rust few weeks, but it seems to me a very hard language, to be honest, I never thought only learning a language will be this hard. I am following books and few youtube tutorials. Any suggestions?


  👤 techjuice Accepted Answer ✓
Find one high quality resource, stick with it and finish it all the way through.

I recommend starting with the developer documentation so you can understand the language before anything else. This is normally what I do when starting to learn programming languages, especially when languages first come out.

Learn Rust https://www.rust-lang.org/learn

Learn ARM Assembly https://developer.arm.com/documentation/dui0473/m/writing-ar...

Learn Go https://golang.org/doc/

Learn x86_64 Assembly https://software.intel.com/content/www/us/en/develop/article...


👤 mactavish88
I'd recommend:

1. Identify a few projects you'd like to implement (toy ones if you want, or applications that exist in languages you already know well; or try to implement the Advent of Code problems: https://adventofcode.com/).

2. Organize them by your perceived difficulty of implementation (Advent of Code is already kinda organized in increasing order of difficulty).

3. Do your best to implement each project, experimenting with different approaches to architecture, testing, etc.

Having experience in many other programming languages, there are honestly so many different ways to architect and implement a Rust program compared to other languages (especially if you compare to a language like Go). Also, getting the hang of composition (with or without traits), when you come from other languages, is quite challenging.

The whole async/await thing is another story entirely. I currently do full-time Rust development and, tbh, I'm not totally convinced that async/await is always better in all situations. I started toying with Rust back in 2018 and have been doing full-time dev for a few months, and I'm still continuously learning new things.

The great thing about Rust is that it gives you so many options.

The terrible thing about Rust is that it gives you so many options :-)


👤 K0nserv
1. Read the Rust book[0] front to back. Yes seriously, the whole thing. Rust is different enough from other languages that it makes sense to do this.

2. Write 1 or more serious rust projects of your own choosing. Aim for projects that’ll be thousands of lines of code.

3. Read “Programming Rust”[1]

4. Write more projects

This is what I did anyway.

The Rust discord has a beginners channel which is invaluable for asking questions when you get stuck.

0: https://doc.rust-lang.org/book/

1: https://www.oreilly.com/library/view/programming-rust-2nd/97...


👤 iscoelho
Before learning Rust, I would highly recommend learning C/C++.

Rust has patterns that are very different from any other language I know of. This is why it comes across as an extremely difficult language. I would say however that C comes very close to having similar patterns (if you have discipline!) partially due to lack of OOP.

I'd also say that Rust is a poor language to learn multi-threaded programming. You absolutely won't appreciate Rust until you work in a language with no safety & learn the rationale yourself.


👤 melling
The HN noise on Rust is so deafening that 5 days ago I decided to give it a try myself.

Here are a couple of links that I have used:

https://fasterthanli.me/articles/a-half-hour-to-learn-rust

https://github.com/Dhghomon/easy_rust

I’m using http://repl.it to learn in the browser.

My GitHub repo, which will hopefully expand over the next couple of weeks:

https://github.com/melling/RustHelloWorld


👤 PopeDotNinja
I haven’t learned Rust yet, but in general I like to pick a tightly scoped, well defined problem & try to build that before I look up how to actually solve it. If you’re interested enough to try it, build a JSON parser, which is something I like to do.

👤 nesarkvechnep
What is your prior knowledge? I ask because it's interesting you think learning a language is usually easy. Knowing the syntax is not knowing the language.

👤 aronpye
Have any C developers jumped ship to Rust?

I can see C++ developers migrating as the philosophy of C++ seems to be more aligned with Rust than C (C solves problems by forcing you to write more C, C++ solves problems by adding more language features).

I’m not sure whether I would enjoy using Rust as I dislike the verbosity of C++ with its more complicated syntax and multitude of “features”.


👤 rrao84
Follow-up question .... why learn Rust?

(asking to understand and not troll)


👤 A-Train
I like this one https://github.com/rust-lang/rustlings. It is a set of exercises in which you must fix fragments of the code to pass the test.

👤 mraza007
What do you think about learning C++ over Rust Because if we look at C++ it has a very mature ecosystem as it has been around for a long time and alot of companies are using C++

👤 potatochup
Aside from the rust book, I learnt by porting some older python scripts (~100 lines) into rust. It was good starting with something that had a simple data flow so you don't have to worry about lifetimes as much, and performance isn't a concern so you can just ".clone()" if you don't want deal with references