r/teenagersbutcode • u/CubineGaming C++ • 4d ago
Other discussion How to learn Rust
I have quite some experience with C++, but after considering everything I would have to do, and some inconveniences of the language, I am choosing to switch to Rust.
In Rust, I would like to write my own OS, but first want to get experience by making smaller scale projects. As I already know C++, I primarily need projects where I will write a lot of code (to be familiarized with the syntax and where I will use features such as ownership, lifetimes, borrowing, and Box<T>s to be prepared for making an OS in Rust.
May anyone suggest projects I can work on (without a tutorial, but with a good amount of docs available)
5
u/realrealvantheman 4d ago
Dont write an OS in Rust. Trust me, bootstrapping a Rust compiler on a new system is very hard. It will help you a lot if you write it in something simpler.
1
u/TheFrogg3 3d ago
May not be the best way, but if I want to learn a language, I usually start with a website like w3schools and then go to YouTube tutorials for more advanced topics.
2
u/CIMPBIBAI 4d ago
Make a basic OS by yourself (little to no ai) in C before doing it in rust.
If C is a pain in the ass, rust is going to be a kick in the balls for OS development given:
1
u/[deleted] 4d ago
Bro, osdev is one of if not the worst place to use rust. You'll have to use unsafr blocks everywhere, a bunch of features will be locked, and it'll be an overall pain. Just use c. Even freestanding cpp works. But not rust. It just wasn't made for this stuff.
1
u/CommunityJazzlike274 4d ago
writing an OS in C is probably easier than rust
i say this as a rust user and lover
1
u/flowicks 3d ago
https://microsoft.github.io/RustTraining/c-cpp-book/ch00-introduction.html
i also use cpp and planning to learn rust sometime not rn tho. Saved this for then, hope it helps.
0
u/rileyrgham 1d ago
Write your own OS? Lol.