My Favourite Thing About Rust is the Compiler
While going over my installed AUR packages on Omarchy, I stumbled on the rustc command, and so I decided to learn Rust. This blog post serves as my first impressions of the language.
My favourite thing about Rust so far is the compiler, well the error messages outputted by the compiler to be more specific. The compiler guides you like a friend and offers code suggestions when you get compilation errors.
The error messages remind me of languages like Elm and Gleam in the way that they are helpful and friendly. So far learning Rust has been a good experience that I recommend anyone to learn it.
The opinion online about Rust being complex and the borrow checker being absolute hell is a sentiment that I don't share. I can admit lifetimes and smart pointers took a bit of time to understand but overall the language is pretty great.
This little honeymoon phase I'm going through might change when I start learning deeper topics such as macros, threading and the concurrency system, but I'm still optimistic about the language overall.
All the projects I've worked on with Rust have been tiny programs like a safe-rm command that moves files to the Trash folder and a BrainFuck interepter. These programs are not complex and as I work on larger projects I'll get a better perspective.
The favourite feature of the language has to be the let-else syntax. It helps out in situations in which adding a match statement might be a bit too verbose and closures not being suited for that use case.
The example below shows some code that breaks out of a loop when I get back an Err enum.
loop{
let value = some_func();
let Ok(count) = value else {
break;
};
};
In conclusion, I'll give Rust an 8/10. I love functional programming and think Algebraic Data Types should be in every language. The compiler and all the surrounding resources are amazing. Reading the standard library documentation is a bit confusing for me at the moment but with more experience this won't be an issue.