馃摵 Auntie Aerial's Night School
Build Terminal of Tinsel from nothing, in 24 nights
馃摵 "Good evening, and welcome to Night School. You've watched the Midwinter Special. Now you'll see how the picture gets made. Twenty-four nights, one door each, and by Christmas Eve you'll have built the whole thing yourself. Bring a pencil and a mince pie. Mind the tinsel."
This is a course in writing a real Rust command-line application, taught by building Terminal of Tinsel from an empty folder to a released program. Every night opens one door and adds one idea. You'll meet the standard library, clap for commands, serde for data, ratatui for interactive screens and jiff for dates, and you'll learn how to test, ship and release the lot.
Who it's for: anyone who can open a terminal and has written a little code in any language. You need no Rust, because we teach it as we go, ownership and borrowing included. If you already know Rust, skip to Night 11, where the interactive terminal starts.
How it works: each night takes 30 to 60 minutes. Nights 1 to 10 are build-along, where you type the code, run it and see it work. From Night 11 the program is too big to type, so those nights teach the ideas with the key code, and point at the finished files in this repository for the rest. Every night ends with an exercise ("Before morning") and a Rust fact ("Festive fact").
Call your project terminal-of-tinsel, as this repository does, so the commands and paths in the lessons match yours. You can rename it on the last night.
The course has a sister. Count Cathode's Night School builds Terminal of Terror in Go over the 31 nights of October. The two programs do the same things in two languages, and docs/go-to-rust.md compares them.
馃搮 The programme
Week 1 路 The First Doors: foundations
| Night | Lesson | You'll learn |
|---|---|---|
| 1 | Light the Tree | Installing Rust, cargo new, fn main, cargo run and cargo build |
| 2 | The Running Order | clap: a Cli struct, --help, --version, subcommands and match |
| 3 | Meet the Guests | Structs, Vec, String and &str, ownership and borrowing, a list command |
| 4 | A Fact from the Cracker | Option, a random generator of your own, seeds |
| 5 | Data under the Tree | JSON with serde, derive macros, include_str! |
| 6 | Packs of Creatures | Modules, one file per creature, include_dir!, a Vault |
Week 2 路 By the Fire: errors, tests, colour and the first screen
| Night | Lesson | You'll learn |
|---|---|---|
| 7 | Speak Its Name | Result and ?, an error type with codes, name lookup, "did you mean" |
| 8 | Check It Twice | cargo test, data tests, end-to-end tests, clippy and rustfmt |
| 9 | Deck the Terminal | Colour, boxes, wrapping, terminal width, plain mode |
| 10 | Every Creature in Its Colours | Themes, the creature page, ASCII portraits, --json |
| 11 | Channel 25 Tunes In | ratatui: raw mode, an event loop, drawing a frame |
| 12 | Fitting the Screen | Dividing the screen, wrapping, scrolling, testing screens without a terminal |
Week 3 路 The Midwinter Special: the explorer and the games
| Night | Lesson | You'll learn |
|---|---|---|
| 13 | St Lucy's Night: Turn the Page | Sections and tabs, enums for state, lifetimes, a gallery with a cursor |
| 14 | Whispers in the Snow | Search mode: text input, folding accents, snippets |
| 15 | Your Host, Auntie Aerial | Ticks, TV static, snow with no state, typewriter text |
| 16 | Writing the Crackers | Generating quiz questions from data, hiding the answer, distractors |
| 17 | The Christmas Cracker Quiz | A second screen, feedback, ranks, wiring a command |
| 18 | Behind the Frosted Window | Guess the Guest: the frost, its reveal order, stages and points |
Week 4 路 The Long Night: progress, rituals and release
| Night | Lesson | You'll learn |
|---|---|---|
| 19 | The Snowball Showdown | Stats and a die, three rounds, narration for one creature or several |
| 20 | What the Stocking Remembers | Saving progress safely, captures and badges |
| 21 | The Longest Night | Dates with jiff, the moon, advent doors, daily seeds |
| 22 | Open the Doors | --json everywhere, community packs from disk, validation |
| 23 | The Night Before the Night Before | Tab completion, man pages, generated files, CI on three systems |
| 24 | Christmas Eve: Sign Off | The changelog, cargo-dist, tagging a release, what next |
Before Night 1
You'll need:
- A terminal. On macOS or Linux, the one you have. On Windows, Windows Terminal with PowerShell works well.
- A text editor. VS Code with the rust-analyzer extension is a fine choice.
- Rust 1.88 or newer. Night 1 walks you through installing it.
- Git, so you can save your progress and look at the finished code.
The finished program is in this repository. Whenever a lesson says "the full file in the repo", it means the file at the same path here, for example src/creatures.rs. Reading ahead is allowed and copying is encouraged, as long as you understand what you copy.
You don't have to wait for December, and you don't have to keep to one door a night.
馃摵 "Channel 25 will now begin its broadcast. Night 1 is this way."