Rust course

Professional training for backend and systems developers

Professional training course on Rust, aimed at developers with experience in other languages who want to use Rust to build backend services, command-line tools, and applications distributed as a single executable.

The course is divided into two parts: the first is dedicated to the language, the second to building a backend service with Tokio, Axum, and sqlx. The first part can also be taken on its own.

The course can be delivered in either Italian or English, and can be held either in person or remotely.

Taking part in the course requires excellent programming skills in at least one other language; access to a computer running Linux, Mac, or Windows with WSL2 is also required.

The planned modules, each lasting half a day (4 hours), are as follows:

  • Introduction to Rust
    • Toolchain, rustup, and Cargo;
    • Variables, mutability, and primitive types;
    • Functions and control flow;
    • Project structure;
  • Ownership and borrowing
    • Ownership and moves;
    • References and borrowing;
    • Slices;
    • Introduction to lifetimes;
  • Structs, enums, and pattern matching
    • Structs and impl blocks;
    • Enums;
    • Option and Result;
    • Pattern matching;
  • Error handling
    • Recoverable errors and panic!;
    • The ? operator;
    • Custom error types with thiserror;
    • Application errors with anyhow;
  • Traits and generics
    • Traits and implementations;
    • Generics and trait bounds;
    • Trait objects and dynamic dispatch;
    • Standard library traits (From, Display, Default, Iterator);
  • Collections, iterators, and closures
    • Vec, HashMap, and String;
    • Iterators and adapters;
    • Closures;
    • Smart pointers (Box, Rc, Arc);
  • Modules, crates, and testing
    • Modules and visibility;
    • Crates, dependencies, and workspaces;
    • Unit and integration tests;
    • Documentation with rustdoc;
  • Concurrency
    • Threads;
    • Send and Sync;
    • Mutex, RwLock, and Arc;
    • Channels;
  • Asynchronous programming
    • async and await;
    • The Tokio runtime;
    • Tasks, select!, and cancellation;
    • Asynchronous I/O;
  • Backends with Axum (part one)
    • Routing and extractors;
    • Shared state;
    • Serialization with Serde;
    • Error handling in responses;
  • Backends with Axum (part two)
    • Middleware and Tower layers;
    • Database access with sqlx;
    • Migrations and transactions;
    • OpenAPI documentation with utoipa;
  • Distribution (optional)
    • Application configuration;
    • Static builds and cross-compilation;
    • Web interface embedded in the executable;
    • Logging and tracing;

During the modules, preparatory exercises will be provided for learning the topics covered.