"C is not a big language, and it is not well served by a big book."
— The C Programming Language (1978), Kernighan & Ritchie
Rust, however, is a big and complex language, and together with the surrounding ecosystem (essential to getting anything much done in Rust), an overview of the whole thing can be very useful indeed.
Lars Wirzenius was kind enough to give me such an introduction in June/July over the course of four hours, split into two lessons two weeks apart.
Rust is something I’ve been meaning to take a closer look at for a few years now. I’d anticipated reading a few tutorials and diving into writing something with it. However, as I already have many good tools to use for the work I do, and I knew very little about Rust and what it might be good for, I kept putting it off.
As I was getting started in my career in the 1990s I kept hearing that Java was going to be the next big thing, and I poked a bit at v1.0 and put it away, thinking that I’d probably take a serious look at it “next year”. I still haven’t, and checking my laptop now, I don’t even have the Java runtime environment installed — nothing on my machine appears to use it. Java may be popular in some industries, but I seem to have avoided it almost entirely.
Rust is a different story. It is getting (somewhat aggressively) pushed into the ecosystem around me, including the Linux kernel. “Rewriting it in Rust” has become the newest form of fanfiction, and the attitude of some from the Rust community has ruffled a lot of feathers by proclaiming that not only should nothing new be written in C, but that we must race to rewrite everything in Rust as quickly as possible. I find myself wishing that such fervour could be harnessed to address some of the more pressing issues of our time.
That said, Rust does interest me. I like learning different languages, and nothing else has come along recently that has demanded my attention like Rust has.
Back in June, Gavin Henry kindly wrote Rust bindings for the Librecast libraries, which led to me starting to ask more serious questions about Rust.
It was right at this point that Lars offered to give me some Rust lessons to introduce me to the language. I’d never had a programming language lesson before, so I wasn’t really sure what to expect, but this seemed too good an opportunity to pass up.
Lars also runs a commercial Rust training course, and has been kind enough to offer some initial Rust training to some Open Source developers for free. Lars’ main motivation for doing this appears to be his own personal passion for Rust, and enthusiasm for teaching.
Our first two hour lesson (conducted on BigBlueButton), started with a gentle introduction to Rust, covering the advantages and disadvantages, how it came to be, the languages that preceeded it, and the memory models that they use.
Rust takes a different approach to memory management. Rust is neither garbage collected, nor manual allocation, but instead takes a third way based on ownership — an approach that I suspect we’ll see adopted in other new languages now that it has been shown to be viable. Rust seems more like a first step than a destination, and I have no doubt that it will strongly influence the languages that come after it.
I was somewhat bemused to see the let operator making a
comeback. It was optional in BASIC on my Commodore 64. I suppose there
are worse things to ressurect from the 8-bit 80s. At least they haven’t
brought back line numbers.
Lars then walked through the process of building an Enterprise version of the classic “Hello, World” program, complete with command-line parsing (using “clap”), file I/O and error handling.
The most interesting part of this for me, and the first thing that started to draw me into Rust is the error handling. I’ve seen a lot of different approaches to error handling in different languages, and most are ugly and painful to work with. The way Rust functions can cascade a result back to the top of the call stack is really nice.
A second, follow-up lesson two weeks later went into some of the more advanced topics like traits, generics and concurrency. Each of these could easily be a separate lesson. Lars gives an introduction to each topic, which is a great starting point for further learning.
There is a lot more to Rust than I’d previously realised, and “memory safety” is just one part of the story.
One point that Lars makes regarding all these strict compiler checks, is that a Rust compiler is able to optimize much more aggressively than can be done for C, resulting in some cases in faster code.
Rust looks more like an alternative to higher level languages like C++ than a replacement for C for the kind of programs I work on, but I can think of situations where it could be a better choice.
I have no plans to pack away my C compiler any time soon, but Lars has inspired me to take a more serious look at Rust and try it out for some smaller programs in the near future.
Rust is a language still under active development, and some features of the language (eg. concurrency) are still taking shape. Lars explains that Rust tries very hard not to break existing code, and the strict crate versioning and tools appear to support this.
If you are fortunate enough to learn some Rust with Lars, be prepared to ask questions to get the most out of it. Lars knows a lot more about the subject than will fit into a short course, and he will happily go deeper into a topic if you ask.
If I have one criticism, it is the lack of any hands-on programming during the course. Perhaps a small pair programming exercise during the first lesson, followed by a small assignment to complete between lessons would help many of us hands-on learners to absorb the material more thoroughly.
Thank you Lars! I’m looking forward to writing my first program in Rust in the near future.
2025-08-25