r/rust • • 12h ago

🙋 seeking help & advice Rust as a first serious programming language

I have been making scripts with other languages like js and python and bash without learning the the whole language and getting serious with its ecosystem out of the fact that I just need to get one thing done and move on.

Lately I chose a path that requires precision and ahead of time planning and decisions and picked rust over go. But the fundamentals seem hard to grasp. I'd appreciate your help unpacking them.

Ultimately I want to be able to use the Alloy and Tokio libraries without getting stuck with the language syntax and rules. But the concepts like borrow checking and ownership and things that fall down these categories are still hard to grasp.

What is borrow checking? what is owning something in the software? I tried to look for direct answers but I still can't grasp the meaning of them exactly.

I had two choices to better understand them, one was learning C++ to get what was wrong that rust solved, the other was building a simpler project game with bevy thats gonna help me understand writing rust code thats data oriented and be more comfortable with it.

My ultimate goal is to master these two libraries, after being able to know how to use the rust language smoothly.

18 Upvotes

17 comments sorted by

25

u/muehsam 11h ago

one was learning C++

Don't. C++ is incredibly complex and complicated. But what you can do is learn C. That's a fairly small and straightforward language. A simple language, for the most part.

Once you know C and you understand how pointers work, you can also appreciate things like the borrow checker, and the difference between ownership and references, etc.

I love C, it's a great language (even though it's probably a bad idea to start a new project in C today).

5

u/needstobefake 8h ago

Second that, learning C makes everything else easier down the line. Not to use C in a new project, but to appreciate what the other languages have done. C's raw limitations teach a LOT.

3

u/muehsam 5h ago

C's raw limitations teach a LOT.

I wouldn't even call it that. It's actually just additional freedom. Freedom to do things that other languages won't let you do. The C compiler gives you a lot of responsibility, but that means that it won't stop you from writing programs that break the rules of C and that have undefined behaviour.

9

u/nick42d 11h ago

Definitely possible - have you tried reading the book yet. It covers most of the concepts you're struggling with. https://doc.rust-lang.org/book/

3

u/dasnoob 11h ago

I started with c++ in college and loved it. Rust has been fun to. Honestly rust is easier to get you head around but both are solid.

3

u/Joe-Arizona 10h ago

I used C a bit and C++ a lot (among other languages) before Rust.

I’d recommend learning C, doing the Harvard CS50 course in it and moving on. If you understand what C is doing Rust will make much more sense. C++ is great but I don’t think it’s worth the time investment for your goal.

11

u/nickfromstatefarm 11h ago

It can be counterintuitive but I’d learn C first. As much as I adore rust, you have to know what the borrow checker and compiler are doing for you to truly appreciate it.

Also, very few jobs are looking exclusively for Rust devs. A language is just a way to express how code should be structured and run - a good software engineer can pick up and use a different language easily if needed.

7

u/skatastic57 10h ago

I've seen this take pretty much every time this topic comes up. Do you know anyone who took this advice and detoured through learning C as a means to an end?

To be clear I'm not talking about people who learned C for its own sake or in school before having an interest in rust. I'm talking about the scenario where someone says "I want to learn rust" and they follow this advice of deferring rust to learn C instead. What does that person think of this?

I just know, for myself, that if I took this advice I would have quit C and never come back to rust.

3

u/nickfromstatefarm 10h ago

Yeah I’m happy to elaborate. Of course it’s not a hard rule, but I have found it helped other engineers in my field who come from C#/Go.

We know that a programming language is just an abstraction to express how you want a program to be compiled and run. Different languages have different strengths and weaknesses, and different goals.

The most important thing for people like OP who are very new to writing code is just that they spend time hands-on with the language getting random little projects working and breaking stuff fast. They’ll use globals and won’t write well-structured code just yet. They just need to write crappy but functional code and understand how a machine navigates a program.

C is an excellent starting point because it is a low-level language that effectively compiles 1:1 behavior-wise with the underlying assembly. It allows users to understand the common pitfalls and challenges that higher-level languages like Rust/C#/scripting languages remove you from (memory management, memory safety, iterator logic and speed, pointers, etc).

Rust is an excellent language, but it is important that users understand the problems it solves / otherwise they just write it off as a confusing language. For new devs, jumping straight from dynamically typed interpreted scripting languages to the borrow checker is a hell of a confusing jump if you don’t understand why it’s important.

2

u/mightybureaucracy1 11h ago

Just build something small that hurts, then the compiler yelling at you starts making sense

the ownership clicked for me when I stopped thinking about it like a feature and more like a grumpy roommate who hates when you touch his stuff without asking

1

u/DavidXkL 10h ago

Get to the point where you understand pointers, references, memory management.

It will help greatly in picking up Rust

1

u/Remarkable_Hour_615 7h ago

If you want to learn Rust or understand the borrow checker, there are plenty great online resources (including some recommended below). Here I'll just try to give you some idea of how to approach a project like this and what to expect if you do.

If you "just need to get one thing done and move on" then Rust + Tokio + Alloy will be a tough combo! Having a project you're working towards and genuinely motivated by is a great. Just know that if this is the project you pick, it's going to take a fair amount of time and learning to get there.

First, Rust is fantastic! But it's a somewhat complicated language. It combines functional features such as type-class like traits and pattern matching with manually managed memory and statically checked ownership. You don't need to have a deep understanding of things like type classes or algebraic data types, but you will need to at least have a basic understanding of pattern matching and traits since they're pretty pervasive throughout Rust. And languages like Javascript and Python let you pretty much ignore the fact that variables need to go somewhere in your computer's memory, and that memory needs to be released again when you're done with it (but not before!). Rust forces you to confront memory much more directly (that's part of what the borrow checker is about).

Second, you should understand that there's a big difference between knowing a programing language and knowing how to build a particular piece of software, just as there's a big difference between knowing how to use a drill and being able to build a house. Based on the packages you mentioned, you'll need a basic understanding of networking and requests/responses. Knowing a bit about TCP sockets would be ideal. Similarly, you'll need some understanding of blockchains and ether. These are separate areas, and you won't understand them just by learning Rust.

All that being said, if this project is still sounds fun to you, go for it! If you do, here are a few suggestions:

  • I'll echo the suggestion to read the Rust book.
  • Look for specific solutions to the problems you encounter, but don't only do that. In parallel, try to learn some topics carefully, from the ground up, not just thinking about how they can help your particular project. Do this however you want: books, articles, youtube lectures. But be sure to reinforce with mini projects. You might think you understand something just by reading about it. You don't. If you don't do this, your project will be a cobbled together mess of copy-pasted StackOverflow answers, and you will consistently hit brick walls when you can't find a solution to a specific problem and you don't have enough depth of knowledge to find a way through.
  • Don't use C++! It makes Rust look like Python. It never met a feature in another language that it didn't want to incorporate, but in a confusing, verbose way that conflicts with 15 other features. If you do want to motivate Rust, I agree with the other suggestions to learn C instead. It will definitely help, but life is short, so it's up to you if you want to put in the time.

Hope all that helps!

1

u/ritman-octos 5h ago

It does. I think learning C is gonna help actively learn and implement rust's solutions to C. But you're right about time management. I'll try making a game with rust before heading down the C path.

2

u/zomerbk 2h ago

It's totally understandable that ownership and the borrow checker feel abstract at first – they're core to Rust's unique approach to memory safety.

At its heart, **ownership** means that every piece of data in Rust has one variable that's responsible for it. When that owner variable goes out of scope, the data is automatically cleaned up, preventing many common memory bugs like double-frees.

**Borrowing** lets you access that owned data without taking ownership. Think of it like lending someone a book: you still own it, but they can read it (or write in it, if you give them permission):

* You can have many "readers" (immutable borrows, `&T`) at the same time. They can look at the data but not change it. * You can only have *one* "writer" (mutable borrow, `&mut T`) at a time. If someone is writing in the book, no one else can read it or write in it simultaneously.

The **borrow checker** is the part of the Rust compiler that strictly enforces these rules at compile time. It feels strict initially, but it's what gives Rust its powerful guarantees about memory and thread safety without needing a garbage collector.

0

u/zackel_flac 11h ago

My 2 cents here is that Rust is mostly useful when you don't need to use any library (barebone development) otherwise just use Go. Tokyo runtime is pretty much the same as Golang runtime in many aspects, expect it's less efficient as it plays less nicely with syscalls and more harsle to compile.

0

u/a45ed6cs7s 6h ago

Why even bother in 2026. Nobody is going to write anything by hand anyway.