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. |
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.
What’s covered
Getting started — Getting Started, Rust IDEs & Tools, Toolchain, rustup & Editions and Syntax, Comments & Style.
Core language — Variables, Mutability & Constants, Types & Values, Functions & Expressions and Control Flow.
Ownership — Ownership & Moves, Borrowing & References, Slices & Dynamically Sized Types and Lifetimes.
Data and errors — Structs & Methods, Enums & Pattern Matching, Option, Result & Combinators, Error Handling, Collections and Strings & Text.
Abstraction — Generics & Const Generics, Traits, Trait Objects & dyn Compatibility, Any & Downcasting, Closures & Fn Traits, Iterators, Type Conversions & Coercions and Standard Traits & Operator Overloading.
Memory — Smart Pointers, Interior Mutability & Lazy Initialization, Drop, RAII & Drop Check and Memory Layout & repr.
Concurrency and async — Threads & Message Passing, Shared State, Send/Sync & Atomics, Data Parallelism with Rayon, Async/Await & Futures, Pin & Unpin and Async Runtimes & Tokio.
Code organization and tooling — Modules, Crates & Visibility, Cargo & Workspaces, Testing & Benchmarking, Documentation with rustdoc, Tooling: Clippy, rustfmt & rust-analyzer and Debugging & Diagnostics.
Advanced and interop — Macros, Unsafe Rust, FFI & C Interop, Python Interop with PyO3 and WebAssembly.
Applied topics and evolution — I/O, Files, Processes & Environment, Serialization with serde, Numbers & Numeric Computing, Performance & Profiling, Idioms, Patterns & API Guidelines, Incremental Adoption & Refactoring and What’s New & Edition Migration.
Quick reference — Cheat Sheet, with a one-page downloadable PDF.
Reading path
-
Getting Started — install Rust, Cargo, a first program
-
Ownership & Moves and Borrowing & References — the heart of Rust
Then pick topics as you need them, and keep the cheat sheet at hand.
Running example
The examples across the section share one small, original domain: shelf, a Cargo workspace for a library catalogue.
-
shelf-coreis a library crate withBook,Author,Isbn(a validated newtype),LoanandLoanStatetypes, aCatalogtrait, and an in-memory implementation. -
shelfis a command-line binary that searches, lends and returns books and imports and exports JSON. -
shelf-macrosholds a small derive macro; the FFI, PyO3 and WebAssembly pages wrapshelflogic 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.
Related material on this site
-
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 (alazy_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).
Official Rust documentation and resources
-
Learn Rust and the documentation index
-
The Rust Programming Language ("The Book"), chapters 1-20 and appendices
-
The Cargo Book, The rustup Book, The rustc Book, The rustdoc Book
-
The Clippy Book and the Clippy lint list
-
Asynchronous Programming in Rust (the Async Book)
-
The Unstable Book (cited only for nightly-only features)
-
Release notes, releases.rs, the Rust Blog, the RFC Book, Project Goals
-
Community references, labelled as such on the pages that use them: Rust Design Patterns, The Rust Performance Book, The Embedded Rust Book, The Little Book of Rust Macros, Rust Atomics and Locks
Rust ecosystem documentation
-
serde (and its API documentation), serde_json, serde_path_to_error, toml, rmp-serde, serde_yaml_ng
-
Rayon and the Rayon FAQ, crossbeam-channel
-
criterion, proptest and the Proptest Book, insta, cargo-nextest, cargo-llvm-cov
-
Tokio tutorial, tokio, tokio-util, futures, pin-project-lite, async-trait, tokio-console
-
PyO3 (and its API documentation) and maturin
-
wasm-bindgen, js-sys, web-sys, Wasmtime, the WebAssembly Component Model, WASI
-
rust-analyzer, Miri, cargo-flamegraph, samply, RustSec, cargo-deny
-
About docs.rs (how crate documentation is built and hosted)
Other references
-
pytest documentation, used to test PyO3 extension modules from Python
-
PEP 703 — Making the Global Interpreter Lock Optional in CPython (free-threaded Python)
-
Node.js: WebAssembly System Interface (WASI), used to run the WASI examples