An interactive, compiler-verified Rust reference organised as a navigable tree.
- 555 entries in 19 branches: language basics, primitives, collections, strings, iterators, ownership and smart pointers, structs, enums and patterns, traits and generics, closures, error handling, control flow, modules and Cargo, macros, operators, concurrency and async, I/O, advanced topics, compiler errors and cheat sheets.
- Every example is compiled and run at build time with the local
rustc(edition 2024). The "Output" shown on each page is the real stdout. - Broken examples are verified too. Each "does not compile" block must fail with the exact error code it claims (e.g.
E0382), and the real compiler message is shown. - Method ownership is checked by the compiler. For every method or function entry the build compiles a probe line such as
let _ = Vec::<u8>::push;, so a method listed under the wrong type fails the build.
content/ documentation source, one Markdown-like file per branch
tools/build.py parser + verifier -> site/data/rustref.json
site/ the app (no framework, no build step for the front end)
index.html
app.css
js/main.js bootstrap, router, search palette, shortcuts
js/tree.js data-driven, lazily rendered, keyboard-navigable tree
js/views.js page renderers (entry, branch, home, library)
js/search.js exact / prefix / multi-token / typo-tolerant search
js/visuals.js memory-diagram explainers with pointer arrows
js/text.js escaping, inline markup, Rust/TOML/shell highlighting
js/meta.js kinds, receivers, provenance
js/store.js bookmarks, learned, history (localStorage)
data/rustref.json generated
Requires Python 3 and a Rust toolchain on PATH.
python3 tools/build.py # strict: any broken link or failing example stops the build
PARTIAL=1 python3 tools/build.py # while drafting: unresolved links become warnings
python3 -m http.server 8000 --directory site # then open http://localhost:8000Compilation results are cached in .cache/ by a hash of the code, so rebuilds are fast.
# Category title top-level branch (a category may span several files)
> One-line description
## Group > Subgroup branch path inside the category
### name | Owner {optional-id}
sig: pub fn push(&mut self, value: T)
params: value — the element to append
returns: Nothing
purpose: One sentence: what it does.
when: When you'd reach for it.
related: vec-pop, vec-insert (entry ids)
mistake: A common mistake. (repeatable)
since: 1.70
also: Collections > Vec > Access (also show the entry in another branch)
visual: vec-memory (attach a visual explainer)
tags: extra search words
probe: Option::<&u8> (override the ownership probe receiver)
Free text with `code`, **bold**, [[entry-id]] / [[entry-id|label]] links,
tables (| a | b |), lists (- item), #### subheadings and "! note" lines.
```rust compiled and run; stdout becomes the Output
```rust,fail=E0382 must fail with that error code ("fail=syntax" for parse errors)
```rust,panics must compile and panic
```rust,ignore shown only (third-party crates)
```output manual output for the preceding ignored block
Owners such as Vec, str, slice, Iterator, HashMap, Option are registered in OWNERS in tools/build.py (doc URL and probe expression). Special owners: concept, keyword, macro, operator, syntax, trait, attribute, cargo, error, cheatsheet, tokio, crate.
Ids default to owner-name (e.g. vec-push, iterator-collect, str-chars); concepts, errors and cheat sheets use the name alone.