Recipes
Task-oriented examples. Each page takes one job — hold records, read a file, parse text, build a CLI — and shows the idiomatic Axle for it, with the reason each shape is the right one.
If you’re new, read the Language tour and Conventions first — they cover the shape of the language and the style every recipe assumes.
Index
| Recipe | What you’ll learn |
|---|---|
| Collections | ArrayList, HashMap, HashSet, fixed arrays, iteration patterns |
| Object-oriented programming | classes, inheritance, traits, generics, is / as |
| Files and I/O | Path, File, BufferedReader / BufferedWriter, Scanner, in-memory streams |
| Strings and text | the string surface, StringBuilder, parsing, JSON, CSV, regex, encodings, hashes, UUIDs, semantic versions, escaping |
| Numeric and time | primitive methods, math::, Random, LocalDateTime, durations |
| CLI tools and system | argv, env, standard paths, child processes, host info, logging |
Concurrency and error handling have their own chapters next to the language features they exercise:
| Pattern | Chapter |
|---|---|
spawn / Future<T> / await — the stackful task | Concurrency → The task world |
async fn / Future<T> / await — the coroutine backing | Concurrency → The async world |
Thread::run / Thread / .join() — a platform thread | Concurrency → The third backing |
locks, channels, atomics, synchronized, Shared<T> | Concurrency → Concurrency primitives |
try / catch / throw, defer, custom exceptions | Errors → Error handling |
How to read these
Every example is a self-contained snippet. Where it would compile
as a full program, it’s shown as a fn main() : i32. Where it
illustrates a method or class fragment, just paste it into a
larger program.
Throws clauses are listed when they’re non-obvious — the compiler will tell you if you miss one.
Most examples don’t show error handling for IOException / IndexOutOfBoundsException etc.; in real code, propagate or
catch them per error-handling.md.
See also
- Language tour — the syntax these recipes assume.
- Conventions — naming, file layout, when to use which ownership mode.
- Memory model — how
new T(...)is routed to stack / arena / heap / shared. Shared<T>reference counting — the refcount lifecycle behind the task-world recipes.- Standard library overview — the module map every recipe pulls from.
- Concept index — every concept on one page with a link to where it’s documented.