Rust: Three Months Later
Intro
A couple of months back I posted about may first impressions of the Rust programming language. From then until now I have been trying to get as much practice as possible and I this post I want to talk about how my opinions on some of the topics of my last post changed.
What I Have Build So Far
I have built a multitude of tools including a shellcode loader using the NT API, a Chrome password dumping tool using the Windows API, a RESTful API using Actix and a tool interacting with a Postgres DB using Diesel.
So while I am still far from having seen it all, I feel like I have had a go at the most common use cases.
On Options and Results
In my last post I complained about Options and having to unwrap them. I have since done a complete on this topic, once you get used to results and options they become really comfortable to use.
These datatypes give you a clear picture of where in your code something might go wrong and force you to think about handling these errors and edge cases. Since you are able to use the .unwrap() function you are not forced to add error handling for every error and can let your program crash, but in case you want to recover from error you have the option to. Using match statements to unwrap your option and error types feels and looks good, the control flow is quick to write and easy to understand.
Compile Speed
While compiling on your host system is done quickly, using a container for compilation is painfully slow. I am sure there is a way to speed up compilation by caching some of the results, but I did not have the time to investigate this.
Lifetimes
While lifetimes seem to be one of the most complained about feature of Rust, I had very little issues with them. In the beginning it might not be super intuitive, but the more you code, the more you understand them and get a feeling for where to use references and the .clone() method. When looking at my earlier pieces of code there certainly is way too much cloning going on, but it is becoming less and less. I feel like having coded in C before helps a lot, if I did not have that experience I would most likely be confused as well.
Conclusion
The more I code in Rust the more I enjoy it. I will keep on coding and post updates whenever I feel like I have reached a now level of understanding.