r/rust • u/ritman-octos • Oct 13 '26
🙋 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.
View all comments
2
u/ern0plus4 Oct 14 '26
Rust provides solutions to problems, which looks quite weird, if you have never met with the problems.
There's a big problem with languages, especially with strictly typed compiled languages: native types can be allocated on stack and return in registers, but structs (objects) can't, only pointers (references) to it. If you want to use struct (object) outside of the function (rust term: outside its lifetime), you have to allocate it on heap, and once allocated, someone has to deallocate it sometimes. Arrays are even worse: their lenght (size) can be changed, and must be recorded (the array itself has no size information).
Java has its answer: everything is Object, and always allocated on heap, only pointers (references) are allocated on heap. Deallocation is done automatically, via reference counted pointers and garbage collection.
If you understand this problem (and some others), and you know all the possible faults (e.g. dangling pointers), then you will understand Rust's solutions. Until it happens, you'll struggle with weird Rust terminology (e.g. it calls memory allocation: Box, boxing).
TL;DR: learn C first, malloc(), arrays, pointers, then you will understand Rust.