My first time writing Rust

Stan Malinowski


Stan Malinowski
I've recently finished the set of Rustlang tutorials. It was a pleasant experience. I have kept my code in a repository, where each of the tutorial sections has a separate folder.
What I like about Rust
There is a set of things I like about Rust, and about the tutorial. Things I like about Rust
- cost free abstractions - when working in JS I sometimes check if it's worth it to use
map
orfor
. Nothing like that happens here. - mix of functional and stateful paradigms - I tried both Java and Haskell and can't say I became proficient in both. I enjoyed the elegance of Haskell, but sometimes the chain of functions became too long. OTOH, doing a getter/setter for so many values is so full of boilerplate, I get tired reading that code. I feel Rust's approach keeps the balance at the right level of abstraction - I can do a functional chain of map(|x|x+1).filter().custom_fn(), etc that is 1 abstraction in my mind, and assign it to a variable. My head is not big enough to keep too many processes or too many variables at the same time, Rust has a bit of each.
fn
keyword is short and sweet- private
fn
s by default - No priviledged
constructor
function - clear error messages
- tests in code
- publishing crates to
crates.io
is easy
What I like about the Rustlang book
- piecemeal delivery of content, does not try to do too much at the same time.
- the bits 'around' the code are well cared for.
Cargo
CLI pacakage manager is used to guide me through creating a new project. This process is repeated a few times. That is convienient for me, as I can remember it better. I remember many troubles with this when learning Java. Starting new project easily is crucial for independent dev experience. In JS create-new-* works for that, but I feel it's less optimized and often not enough. Personal templates are a one way around this, but they need to be updated too. I might do a selection of such templates for myself in the future. - the fact that it's both online and offline - I could easily access the docs
- it has convienient navigation with arrows (left and right arrows switch to previous and next section, respectively).
- Length - it is longer than 1 tutorial and covers a variety of cases
- I was easily onboarded on the 2 usually most tricky at first bits of applications - interfacing with the outside world. Filesystem with io crate and web with http protocol was included in the course, I think it was crucial.
- I've never worked with concurrent programs before - only Node async. I was a bit apprehensive, but the tutorials made a good job of making me feel alright there.
What I don't entirely get
- modules and imports system - sometimes just didn't work for me
Road ahead
I'll use my newly gained knowledge of Rustlang to use it in V8 WASM. I found Let's Code Minesweeper with Rust and WASM by yishn. Adding another game to my portfolio will be :fire:.