Going a Bit Rusty

I’m sure I’m not the first to make a rusty pun but I couldn’t resist. I’ve coded professionally now for around 25 years but unlike many developers I don’t actually know that many languages well. My career to day has been almost exclusively Java starting back with version 1.2 (I learnt on version 1.1). I’ve mainly worked as a full-stack web developer so, obviously, I’ve done my fair share of JavaScript and TypeScript but I never really studied them – I just got on and banged out code, googling when I didn’t understand. That’s the problem with working in a high-stress development environment, there’s never any time to hone your skills. Of course I’ve also had a bash at code in a load of other languages like PHP and Lisp but I’ve never really committed to a project. Now I have some free time I’m thinking it’s time to pick up a new skill and Rust seems to be popular at the moment so I think it’s worth a look.

The Rust website is a model of good design and makes it easy to get started with learning. They offer three options, a book, a set of code exercises, and a number of examples. My understanding going into this is that Rust has similarities to C which is also true of Java so I feel like I should be able to absorb the basics quickly. For that reason I jumped straight into the code exercises.


The code exercises are called rustlings and are held in a GitHub repository that you clone. When you fire up rustlings in a terminal it checks the first exercise and gives you instructions on how to complete it. Open another terminal and head to the exercise file “intro1.rs” and complete the exercise. If you’ve started rustlings with the watch command (rustlings watch) it’ll update the first terminal to show you progress. I’m currently 13.5% of the way though the exercises and have just finished the functions section.

Overall like rustlings but it’s not enough to learn the language from. It’s confirmed that Rust is superficially like Java which should make learning it easier. I’m finding there’s not enough text in the less though. It feels like there should be a short paragraph at the top of each exercise explaining what I’m about to learn. I think it would be best to do the exercises in conjunction with reading the book. For now I’ll see how far I can get with minimal referral into the book. I’ll certainly be reading the book afterwards though.

Returning Values

Something that is catching me out quite a bit is returning values from a function. I’ve only just started digging into what I’m misunderstanding but Rust seems to have expressions (which I think just means it involves an operator) and statements. It seems a statement on a line on it’s own without a semi-colon at the end is the thing that gets returned by the function. That is going to trip me up left right and centre. I’m hard wired to look for an explicit return keyword.