Rust Reference

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

The reference material consulted while preparing these pages is listed in the section bibliography.

This section is written against Rust 1.99.0, the current stable release (2026-10-01), and the 2024 edition, checked on 2026-10-06. Rust ships a new stable release every six weeks from a train of three channels — stable, beta (1.100, due on 2026-11-12) and nightly (1.101) — and each page notes the release in which a feature appeared, so you can tell what needs a recent compiler. Nightly-only features are labelled as such where they are mentioned.

What Rust is

Rust is a compiled, statically typed systems language whose central promise is memory safety without a garbage collector. An ownership system, checked at compile time, decides when every value is freed and rules out dangling pointers, double frees, iterator invalidation and data races — with no runtime cost. Around that core, Rust offers an expressive type system (enums with data, pattern matching, traits and generics), zero-cost abstractions such as iterators and async/await, a single official toolchain (rustup, Cargo, rustfmt, Clippy, rustdoc, rust-analyzer), and a large package ecosystem on crates.io. It is used for operating systems and browsers, command-line tools, network services, WebAssembly, embedded firmware and native extensions for other languages.

The shelf scenario

The examples across the section share one small, original domain: shelf, a Cargo workspace for a library catalogue.

  • shelf-core is a library crate with Book, Author, Isbn (a validated newtype), Loan and LoanState types, a Catalog trait, and an in-memory implementation.

  • shelf is a command-line binary that searches, lends and returns books and imports and exports JSON.

  • shelf-macros holds a small derive macro; the FFI, PyO3 and WebAssembly pages wrap shelf logic for C, Python and JavaScript.

The Axum section reuses shelf-core as the domain layer of its Bookshelf web application, so you can see the same types behind a CLI and behind an HTTP API.

New here? Read in this order

Then pick topics as you need them, and keep the cheat sheet at hand.

mindmap root((Rust Reference)) Getting started Toolchain and editions Syntax and style Core language Variables and constants Types and values Functions and expressions Control flow Ownership Moves Borrowing Slices and DSTs Lifetimes Data and errors Structs and enums Option and Result Error handling Collections and strings Abstraction Generics and traits Trait objects Closures and iterators Conversions and std traits Memory Smart pointers Interior mutability Drop and layout Concurrency and async Threads and channels Send, Sync, atomics Rayon Async, Pin, tokio Tooling Modules and Cargo Testing and rustdoc Clippy and debugging Advanced and interop Macros Unsafe C, Python, Wasm Applied I/O and serde Numbers and performance Idioms and adoption What's new

What’s covered

Quick reference — Cheat Sheet, with a one-page downloadable PDF.

  • Building web services and server-rendered applications in Rust: the Axum section, which links back to these pages for async, tokio, serde and error handling instead of repeating them.

  • Command-line applications with clap and terminal UIs with Ratatui: CLI Frameworks in Go & Rust, with packaging and testing on the neighbouring pages. A dedicated CLI Apps section is planned (issue #236), as is a comparison of programming languages (issue #196).

  • Comparisons with other languages' references are linked from the relevant pages (C and C++ memory and FFI, C# native interop, Swift memory safety, and the async pages of C#, Swift, JavaScript, Python and Java).

The section draws on the official documentation first, and on five books for concept coverage. A sixth book provided by the requester, Rust Unleashed, is not used or cited, because it has no publisher or retailer page that could be linked, a placeholder ISBN, code that does not compile and factual errors.

Bibliography

Books

  • Nouman Azam, Advanced Rust: Exploring Power Features of Rust for Intermediate and Advanced Developers, 1st edition (technical reviewer Yogendra Sharma). Apress, 2026. ISBN 979-8-8688-2991-8 (print), 979-8-8688-2992-5 (eBook), DOI 10.1007/979-8-8688-2992-5. Publisher page.

  • Lily Mara and Joel Holmes, Refactoring to Rust, 1st edition. Manning, 2025. ISBN 978-1-61729-901-8. Publisher page; companion code.

  • Manjunath Gangappa and Rajkumar Rangaraj (foreword by Trask Stalnaker), Mastering Distributed Observability in Rust: Implement OpenTelemetry in a real-world, multi-container e-commerce architecture, 1st edition. Packt, 2026 (June). ISBN 978-1-80667-179-3 (print); eBook ISBN 978-1-80667-178-6 as given by retailer listings. Publisher page; companion code. Chapters 2 and 9 were used for this section.

  • Indo Yoon (technical reviewer Joshua Mo), Beginning Axum: Learning Modern Web Development With Rust, 1st edition. Apress, 2026. ISBN 979-8-8688-2630-6 (print), 979-8-8688-2631-3 (eBook), DOI 10.1007/979-8-8688-2631-3. Publisher page; companion code. Chapter 1 (the Rust refresher) was used for this section, and chapters 3 (unwrap() in handlers), 4 (a lazy_static! JWT secret) and 5 (a mutex around a broadcast sender) for the notes on outdated practice.

  • Ethan Crossley, Hayden Van Der Post and Alice Schwartz (credited inconsistently), Rust for Scientific Computing: Numerical Methods, Simulations, and Linear Algebra. Reactive Publishing, 2026. No ISBN is printed; retailers list the paperback as 979-8-19849-392-6. Publisher site. Consulted for topic coverage only: no facts or code were taken from it.

The books are consulted references, not the primary source. On any discrepancy, and wherever a book is silent on a later feature, the official documentation wins; where a book shows an outdated form, the pages say so in prose (collected on What’s New & Edition Migration).

Other references