righttech.blogg.se

Rust language book
Rust language book












rust language book

The more knowledge you have in your artillery, the more you’d be able to express yourself while writing code. At some point, I doubt there was any video content on Rust I had not watched. In 2019, I scoured YouTube for every video on Rust, watching conferences, and tutorials. Not because if you don’t things would go bad, but because these concepts are baked into the type system.Ĭhapter 3: The expression of knowledge, and possibilities. Even if you don’t go to MIT to learn about how computers work, you can’t help but think about some of these things. But with Rust, you are conscious of what you are doing. For instance, in javascript, everything is on the heap, you don’t think about it. I hadn’t spent much time optimizing for performance previously, but when I started writing Rust, I got to think about optimization, the feeling was exhilarating, a bit frustrating, but definitely exciting. When you are not used to working with core primitives, and you get to touch the holy grail, you feel like you have to advocate for the holy grail. I did abandon it later though and go with the 128-bit integer. I spent a lot of time on it, reading what was in the standard library and adapting it to my 91-bit integer. I didn’t need a 64-bit integer, or a 128-bit integer so I invented my 91-bit integer. When I built this in Javascript, it was relatively easy. Xbyte was a tool I made to convert bytes into human-readable sizes and vice versa.

rust language book

Instead, I started rewriting my JS libraries in Rust. So I decided to put it aside till I had other people pitch in. In the time I took to learn rust, and finish up on the proof of concept, I burnt out and took a break from writing code. After building the proof of concept in Javascript, my search for the ahead-of-time compiled language for the main project began, then I found Rust.

rust language book

I took a screenshot and kept it on my Whatsapp status for like 3 days (even though I didn’t think anyone cared to see it).īack to why I learnt Rust, byte stash. When I was done, “beautiful” was what I’d describe the end result as. The aim was to write it in as few lines as possible, eliminating all the default scaffolding code.

Rust language book code#

In the Rust book, there was this exercise, “12 days of Christmas” I rewrote that particular piece of code over and over again. When you get the hang of it though, the feeling is ecstatic. With the static type system, the compile-time optimizations, it’s possible to lose track of what you’re actually working on. But in the early learning phase, when writing it, it can be hard to follow. Rust is beautiful, and things make sense as you learn. That didn’t mean Rust was without qualms. That’s the problem I had with Golang and its walrus assignment operator at the time, its use just wasn’t as intuitive to me as I’d have wanted it to be. If I find it intuitive I can say I am already a fan of it, and if I don't find it intuitive then, hehe. Whenever I discover a new programming language, there’s this thing I do with it, it’s probably not the best way to judge a language, but when I see a “-.lang” website, I go in and try to reason about the semantics. So, I decided to search for another option. Of course, C/C++ was the first option that came to mind, but the second thing that came to mind was the possible pitfalls that one could encounter while using it. The thing is I didn't know what language to use. The plan was to write a Proof of concept in JavaScript, then write the actual program in an ahead-of-time compiled language. Before Rust, I was working on Byte Stash, a decentralized file system. Rust had built a bit of a reputation, that prompted me to do some research on it even though I had no use for it at the time.Ī bit of a back story. My Rust story started when a 17-year-old me found some articles about it on Stack Overflow.














Rust language book