adventures with #12in23 - RUST
Still on trend of catching up and publishing existing pieces of writing please find below for your viewing pleasure Adventures with 12in23 - RUST edition.
Starting this month (The month being March, I'm quite a bit behind on publishing my 12 in 23 adventures...) I’ve decided to not try speed running the #12in23 instead I’ll try and spend the month trying to learn as much as I can and have time/energy for of the language. Sometimes this might be the 5 and done. Sometimes? I’ve no clue yet but hopefully a few more than that.
Mechanical March is upon us, and with it once again I’m going with a recommendation. RUST is supposed to be the best bang for the buck, and an undisclosed higher power be my witness I did a lot of banging my head on the wall for the first hot minute.
Coming from the land(or even, lands at this stage) of adding strings willy nilly RUST’s mechanical approach had me slightly upset. Especially since unfortunately after Elixir’s impeccable Readme’s in the Exercism track, having to go back into documentation for fundamentals felt like a step back from making it accessible.

It did however result in me learning, and this being the point of the exercise I can’t go complaining that much. Within the example above we can also see that we can (but don’t have to(but likely should)) declare a variable type while declaring variable.

Like so, where I declare minutes_in_oven variable, a 32 bit integer.
Rust is hard. Like, really. I’m tempted to take a dig at the Exercism instructions here because “look up documentation” doesn’t seem good enough in an exercise marked as “Learning” in the track. Even having become used to engaging with documentation, just reading the documentation didn’t help here. But then in a true rusty fashion I’ve arrived at the concept of ownership, and maybe the documentation wouldn’t be so mind bendingly impossible to follow had I followed the recommendations and read “The book” first.
So consider above paragraph the extent of whining I’ll allow myself having to deal with a difficult concept and import crates to work with Enums. Rust is challenging, I’ll take the time to RTFM and come back in a few days, or hours. It’s time to brake down big anxieties into small ones and tackle them one at a time (thanks Hyperplexed! (great YouTube channel about frontend)).
Reading, albeit slowly due to outside circumstance, through “the book” I’ve stumbled upon the first thing that made me go “that’s pretty neat”. Part of what differentiates an expression from a statement is whether it has a semicolon at the end. Statements don’t return values, expressions do. We can’t bind a statement to a variable name, we can absolutely do that with an expression! Simple, short but pretty sweet nonetheless.
&*<String> to convert a string into a &str. This had me scratching my head for a bit, decided to give this whole “ask the AI” thing a shot and it’s worked wonders. I’ve learned that this works due to “deref coercion” which is a feature of rust. We dereference the String to get the str and then use & to reference that str. We end up with a reference to the contents of the string, &str.
I've completed the 5 exercises to get my mechanical march badge but good god was this one hard.
EDITOR NOTE :-) Worth noting that ever since March RUST track has been rebuilt and is supposed to now be a lot more new user friendly!
I've completed the 5 exercises to get my mechanical march badge but good god was this one hard.
EDITOR NOTE :-) Worth noting that ever since March RUST track has been rebuilt and is supposed to now be a lot more new user friendly!