Rust Essentials

February 02, 2020 3 minutes

Mostly I do not prefer to read the books written for teaching a programming language. Because a good language community already places the importance on their websites to promote the programming language beautifully as in Python and Rust. In these websites, you can find documentation, tutorials, even a free ebook that allows you to read from the website directly, and they’re mostly up-to-date.

As you know, Rust is not an easy-to-learn programming language. So I frequently look at the official documentation of Rust, and sometimes I choose a random topic and read them again and again. Before starting to read this book, I took a look at the pages and saw some details that I still missed on the Rust documentation. Then I read the entire book thoroughly.

My ebook was the first edition, and there were missing topics like async programming. The author published the second edition in 2017, and it seems he will need to prepare a new version to include the last changes in the language. That’s why I do not prefer to learn a programming language from a book. Rust is improving rapidly, so you need to follow the official documentation always.

Another issue that I feel most lacking right now is macros. I know that they’re similar to Lisp macros, but I still couldn’t have a chance to try it in my pet projects yet. The book shows me an example of usage, but I don’t understand how and where to use it. I wish to see the samples from a specific project or all samples come from the same project.

Finally, I share a table about the pointer types in Rust, when I started learning Rust, it was pretty intimidating. Now it seems a little more meaningful.

Type Name Description
&T Reference One or more references to read T
&mut T Mutable reference Single reference to read and write T
Box<T> Box Heap-allocated T with a single owner that may read and write T
Rc<T> Rc pointer Heap-allocated T with many readers
Arc<T> Arc pointer Like Rc, but enables safe mutable sharing accross threads
*const T Raw pointer Unsafe read access to T
*mut T Mutable raw pointer Unsafe read and write access to T

comments powered by Disqus