Getting Started With Rust


#1

Hi everyone I’m Ryan, so I’ve been bouncing between Rust, D and Python for the last 12 months or so, just picking up on bits and bats but not really committing to learning anything in-depth for any single language. I’ve decided to change that up, commit to a single language and start learning Rust fully (or as fully as I’m capable!).

I’m just fishing for some advice from those who have been at the start of this journey before me…

Right now I’m reading The Rust Programming Language and various articles/blogs online for new starters but wanted to know what else you did to get into Rust and really burn that knowledge into your heads?

Thanks :slight_smile:


#2

Welcome here.

It differs from person to person but what I did was to start working directly on some project. If you don’t have one, you can look towards contributing to any open source repository.


#3

Welcome!

One of important things is to treat the compiler as your friend. As you will see soon, Rust have a steep learning curve, and it will yell at you. A lot. About every single tiny thing. Like, "you have &u8 here, but I want u8". Or, “I won’t cast i32 to usize for you, do it yourself”. But as your friend, it will do it to save you from errors, all those data races, “oops, your data was moved and is no longer here”, undefined behaviors (this alone is sufficient to me to never touch C/C++ for anything larger than toy projects), and so on. In most cases it will not only tell you what’s wrong with your code, but also why, where and how to fix it.

Another important thing is to learn Rust ownership and borrowing rules. Once it clicks for you, writing Rust will be a lot of fun.

And then just write code. Write FizzBuzz :stuck_out_tongue:. r/dailyprogrammer/ may be a good place for some ideas.

Don’t hesitate to ask questions that will arise, even “newbie” ones. I obviously can’t speak for the whole community, but so far every single person was helpful and nice to me.


#4

I’m currently on that same journey myself. My advice is, don’t expect to fully understand everything in the book but do finish it. Then start working on solving some practical problem. I decided to work on a CLI app to consume a REST API with JSON, something I figured I might do a lot of in the future. I’m learning so much from this exercise and I’m finding that sometimes when I hit a problem I recall seeing something about it in the book and I can go back and really understand it. Also, the playground is your friend, learn to use it to ask proper questions of the community. You’ll find that as you’re trying to work out on there how to represent your question you actually solve your problem.


#5

My best advice is ask around, there are a lot more dabblers in Rust around than you might initially imagine. It’s really helpful to be able to talk through things with people. And where that’s not the case ask here and in irc - no question is a dumb one.

Also your in a unique position to have insights for how to make Rust easier to learn for the next person - keep a log of what’s tricky / what would make things easier next time and report back.


#6

Hey everyone, thanks for the replies so far… some good advice there.

So far the compiler has been friendly, but I’m still at the Hello, world! stage of playing around with the language, so not all that much to throw an error at so far!

I’m definitely interested in starting a project that I can work at as I progress through learning the language, so I’ll be sure to think of something :slight_smile:

Thanks again!