Rust - First Impressions
Tags: todayilearned, rust, beginners, discuss
Published: 2022-07-29 17:26:00

Somewhere, someone quite rightly said - "Coding in Rust makes you feel like a genius.". I don't think they were saying so because of how easy it is. Quite the opposite, coding in Rust takes a fair bit of practice. As someone who has used Go, Python, Javascript and Solidity, it is a bit non-intuitive. Especially if you are coming from Object Oriented Programming Domain.

Thankfully, the compiler is awesome. It gives great hints especially at Lifetime and Borrow mistakes in code. That's something I really loved. 

Coming from Go, Python and JS, the mandatory addition of `;` kind of bummed me out. Granted Solidity has the same semicolons, when you are developing Solidity code, it shows in the extensions or Remix.

## Why did I switch to Rust?
I am not really a newbie in Rust. I had used it about a year back when contributing to [`rust-lightning`](https://github.com/lightningdevkit/rust-lightning). I really have to thank the awesome organizers of [Summer of Bitcoin](https://www.summerofbitcoin.org) who advised me that knowing Rust (even beginner level) was an advantage and Jeffrey Czyz & The Blue Matt for being so supportive.

It was an awesome experience and I wanted to continue using Rust but truth be told - as an undergrad freelancer, I wasn't quite sure I would be getting projects in Rust which made me take a break from Rust.

I got started with it in the first place because I wanted to build on Substrate and Solana. While those goals have changed overtime, my enthusiasm for Rust hasn't.

So in 2022, when I saw the hype was getting to Rust, I decided I should revise my concepts again. So far, I am glad I made this decision even though the path hasn't exactly been smooth.

## Rust ain't fast!
You read that right. Rust isn't fast unless you make it so. If you compare simple Rust code with Go and Typescript, chances are Go will come out as a winner.

The advantages of Rust only become apparent when you have a fair amount of knowledge in its advance data structures and **crates**. For eg, you might want to switch from using a simple list to a Vector. Using Hashsets and Hashmaps also offers significant powerup.

It is little things like these that differentiate between a good and a better Rust developer. 

## Rust is Powerful AF
The thing I liked the most about Rust when I had started was how Rust differentiates itself from other languages by bounds. One such example would be the Enums in Rust.

The fact that you can have an Enum which can contain a value like the example below makes so much difference.

```rust
enum Example {
 Type1(String),
 Type2(u32),
 Type3,
}
```
I loved the way once could define such values in Enum. More so that the different values can have different types. 

## What did I use to get back into Rust?
This article is not supposed to be a "list of curated resources for  learning Rust". I would have titled it that way had it been so. Honestly speaking, the [**Rust Book**](https://doc.rust-lang.org/book/) is an awesome resource recommended by every Rust dev but I am more of a video kind of guy.

That's why I followed this awesome YouTube Channel called *Let's Get Rusty**.
{% embed https://www.youtube.com/c/LetsGetRusty %}

Bogdan does an awesome job in pushing out regular content on Rust. His playlists on [Rust Book](https://www.youtube.com/playlist?list=PLai5B987bZ9CoVR-QEIN9foz4QCJ0H2Y8) and [Idiomatic Rust](https://www.youtube.com/playlist?list=PLai5B987bZ9A5MO1oY8uihDWFC5DsdJZq) is something I would always recommend. 

Apart from this, I used **[Exercism's Rust Track](https://exercism.org/tracks/rust)** for any practical exercises along with the occasional personal experiments on Repl.

A healthy mix of Stackoverflow and the Rust Forum helped in solving most of my code related doubts.

That's it really. That's all I used to get back into Rust. 

## Moving Forward
If you haven't been living under a rock, you should have heard about Google C++ successor - Carbon. It is in an experimental state and given the success of Go and Dart, the hype is building around it quite fast. That being said, the Rust community is also growing. Even Meta plans on using this language. 

Funny how I started learning Rust for developing on Solana and Substrate but now am considering learning how to develop Games in Rust using Bevy. 

Going forward, I will be publishing articles on Rust as well along with the usual Blockchain kind. There won't be anything specific in that I would be focusing on whatever piques my interest. If that's your thing then feel free to press the follow button and leave some love on the article. Cheers!