How do I even begin to learn Rust?

I'm a first year CS student and decided to learn rust a few months ago and it hasn't been going well. There's such a vast amount of things to learn and whenever i finish a chapter of the book I've already forgotten the previous one.
I really want to learn the language but im struggling to find a way to retain the information from the book. I'm a beginner at programming in general and I feel a bit discouraged sadly lol
I'm not planning on giving up, does anyone have any advice for a rust/programming beginner? What's the best course of action i could take to learn rust efficiently?
Thank you all!

2 Likes

The best you can do in this case is to practice. Solve problems, start with simple ones and try progressively harder ones. A lot of the knowledge you need to acquire at this point isn't "Rust", it's general algorithmic thinking.

2 Likes

Where can i find problems to solve?

Personally, I'd ask you: how do you learn best? For instance, I learn very well by doing and by teaching, so that's how I learn languages. I'll give examples for both.

Because I learn by doing, I tend to take each new concept in a programming language textbook and try to write code putting it into practice. I'll even go as far as to design one or more small but complete programs using the knowledge I've built so far, and I'll play with each program a bit to see and feel it in action. Yes, it takes about 10x as long as just reading the book, but for me, it's time well spent.

Because I also learn well by teaching, after I read about a concept, I'll often take a short walk or a short break and explain it to myself out loud. I've explained many a programming concept to dishes I was washing in the sink, for instance. They don't seem to mind.

I had a friend in school who learned best by listening, so she'd ask me to explain concepts to her, either instead of or in addition to reading the course materials. That would never have worked for me, but it was hugely helpful to her.

Good luck in CS school! I hope you have a blast!

4 Likes

Rustlings are small exercises.

In this thread, me and a few others mentioned that the book may not be ideal for Rust beginners, like yourself.
I found the book Beginning Rust by Carlo Milanesi to be much more appropriate for a beginner. Strongly recommended.

2 Likes

My advice would be to take time to re-iterate through simple things. If you have understood a particular language construct, take time to "play" with it a bit and try it in several application cases. Maybe some program which calculates something easy, or something that prints out something.

Also, check if the Rustlings course is something that you enjoy.


Here are two other posts by me on that topic (in different threads):

You may also look through the other posts in those threads.

1 Like

Do you have a project you'd like to do in Rust? Programming concepts are easier to learn when you need them, in the context they're useful for.

5 Likes

My advice would be to just go on leetcode and play with simple tasks there.

People often belittle leetcode because it's complex tasks move you firmly into realm of competitive programming and teach you things which are no needed and not useful in real work.

But that the same thing as with basic fitness excercises and professional sport: simple gym visits would make you more healthy while attempt to beat the competition may hurt you badly.

Just go on leetcode and try to solve simple tasks, maybe later medium ones, keep away from complex tasks (unless you want to become competitive programmer) and you may learn any language (including Rust) pretty quickly.

1 Like

With Rust specifically, Leetcode might not be the best way, since AFAIK it often forces highly unidiomatic solutions (ported more-or-less directly from Java, for example). Rust on Exercism might be a better example.

4 Likes

What do you like. I found that pretty colors helped motivate me. For an example of a super simple "pretty" thing, something a beginner can read and tweak, I suggest the julia example

1 . Pull the source * learn how to grab source code *

git pull https://github.com/emoon/rust_minifb
  1. Go into the directory and run the example. * you get pretty motivation *
cargo r --example julia
  1. Read the file examples/julia.rs * you see how it was done *

  2. Edit the code to make the window bigger or change the math for the pattern. * you learn how to edit code *

  3. Run the example again.

cargo r --example julia
  1. Read the error message and then "read the error message" * you learn how to read error messages Very important step *

  2. Go back to step 4 and fix the code. * use this forum for help with errors *

NOTE: Do not miss step 0. Read the book and type all the lessons as you go through the chapters.

1 Like

If you're in a first year CS class, maybe try to (re)solve, in Rust, exercises your teachers give you. (For now avoid doing that for anything to do with linked lists & co)

4 Likes

First, you're bound to succeed with your determination! If you ever find out you forgot a chapter, it must feel really discouraging. Not giving up in that situation is already an achievement.

If you can read a new chapter every day, memorizing them would be a cakewalk. Otherwise, you may want to use more principled methods to eventually make progress.

If you learn better by listening, you might be tempted to use videos. But note this is a huge waste of network bandwidth if you're not actively watching it. Also, not everything you want to learn may be available in video format. In this situation, note that screen readers exist, and are installed by default on most computers. Although they're rarely used by people who are not disabled, they can be a convenient way to listen into arbitrary text.

2 Likes

I've been doing rustlings and enjoying it so far, and I'll check out the book!