Basics of Rust

Published on 30 December 2022

Mumblings

& (slices) are just views to memory owned by some other var.
clone when ran on &str duplicates &str. On doing on String, you get a new copy.
Right way to do is var.to_owned() or string::from, latter is just more to type. (.to_string can also do the job but hey, why learn a new thing to do the same stuff?)

Resources I Followed to Understand Concepts

Before you start, you must have some knowledge about:

This is an excellent tutorial that would help you get up and running with the above concepts. The only thing that I’ll add would be:

I was in an interesting position as I’ve learnt Go before, wherein I learnt not only about channels but other ways to singal or share memory by using lower level primitives in sync package. Along with I had some idea about string pool from Java as well, and from JS I knew about iterators maps and all. Given all this and the fact I’ve gone throw few Rust videos before (mostly after a time and then abandoning the progress I’ve made), when I revisited Rust this time, it clicked for me. I did not have to worry about many concepts about a system level programming language and learning Go made me realize Arc and all are just lower level primitives to share data safely across threads, other primitives are to conserve memory when not needed. After watching the videos I’ve listed below I actually sat and learn about Rust. I started going through https://github.com/sunface/rust-by-practice (few of its examples are not related to learning Rust, but overall it is good) and https://doc.rust-lang.org/rust-by-example/ (this has search button at the top!).

Below is the list of the list of the concepts:

Debug/display

Time Travel Debugging With Rr

Rust Analyzer

I’ll shorten it to Analyzer

Todo