this post was submitted on 26 Aug 2024
3 points (100.0% liked)

Programming

17405 readers
91 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
3
How to learn Rust? (lemmy.world)
submitted 2 months ago* (last edited 2 months ago) by [email protected] to c/[email protected]
 

I want to learn Rust. There are so many resources available and I am unsure which one to go for, and if there are any tips on getting started?

I am a software developer by trade

Edit: Thanks for all the great replies!

top 6 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 2 months ago
  1. Combine iron with moist air.
  2. Wait.
[–] [email protected] 1 points 2 months ago

I agree with the others who say to start with The Book -- https://doc.rust-lang.org/book/

From there, start trying to create small things that you might want or need to do (parsing JSON is something that I needed to do and I started there).

From there, you will learn to fight the borrow checker and start to feel how rust is working. This will be annoying at first, but get better over time (at least in older versions of Rust; I haven't used it in a while so it may be different now).

[–] [email protected] 1 points 2 months ago

As a wise person once told the Internet, don't worry about picking the best one. But if you really had to pick one just start with the rust book. https://doc.rust-lang.org/book/ I would suggest to just dive in with a specific need you want to solve and instead of using your language of choice just use rust and look up stuff as you go. Hands on learning is usually the best learning. The only thing you need to "learn" is how to follow the ownership/borrowing paradigm that rust brings to the table.

[–] [email protected] 0 points 2 months ago (1 children)

IMO the best way to start in a new language is to rewrite some of your previous projects in that language.

I generally start out by rewriting a couple simple 1-3 function console apps, basic leet code stuff like; palindrome, fizzbuzz, reverse an array in place, etc, and some simple unit tests for them. Then I go ahead and rewrite some of my previous projects or uni assignments in that language.

At that point I generally have a good understanding of basics and have an idea of how to approach a new project. When I got to this point in rust I then started on threading, async, why it's easy to return a String and an ordeal to return &str, etc.

[–] [email protected] -1 points 2 months ago

Please, don’t ever use async Rust lol :( it’s so terrible to work with closure recapture. There’s really one way of structuring your code to keep the borrow checker happy and I haven’t yet found it in my projects lol.

[–] [email protected] -1 points 2 months ago

Just hop on a public server and try to make some friends. If you join right after a wipe there will be lots of nakeds on the beach looking for fun.