Axle v0.22.0

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

RecipeWhat you’ll learn
CollectionsArrayList, HashMap, HashSet, fixed arrays, iteration patterns
Object-oriented programmingclasses, inheritance, traits, generics, is / as
Files and I/OPath, File, BufferedReader / BufferedWriter, Scanner, in-memory streams
Strings and textthe string surface, StringBuilder, parsing, JSON, CSV, regex, encodings, hashes, UUIDs, semantic versions, escaping
Numeric and timeprimitive methods, math::, Random, LocalDateTime, durations
CLI tools and systemargv, env, standard paths, child processes, host info, logging

Concurrency and error handling have their own chapters next to the language features they exercise:

PatternChapter
spawn / Future<T> / await — the stackful taskConcurrency → The task world
async fn / Future<T> / await — the coroutine backingConcurrency → The async world
Thread::run / Thread / .join() — a platform threadConcurrency → The third backing
locks, channels, atomics, synchronized, Shared<T>Concurrency → Concurrency primitives
try / catch / throw, defer, custom exceptionsErrors → 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

recipesexampleshow-tocookbook