Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Essential Keywords Reference

What you’ll learn: A compact keyword map for Java developers so Rust syntax stops looking alien during the first few chapters.

Difficulty: 🟢 Beginner

This chapter is a quick reference, not a replacement for the conceptual chapters.

Rust keywordRough Java analogyWhat it usually means
letlocal variable declarationbind a value to a name
mutmutable local variableallow reassignment or mutation
fnmethod or function declarationdefine a function
structclass or record shelldefine a data type with fields
enumenum plus sealed hierarchytagged union with variants
implmethod blockattach methods or trait impls
traitinterfaceshared behavior contract
matchswitch expressionexhaustive pattern matching
if letguarded destructuringhandle one successful pattern
while letloop while match succeedsconsume values until pattern stops matching
pubpublic visibilityexpose outside the module
cratemodule or artifact rootcurrent package boundary
useimportbring names into scope
modpackage or nested moduledeclare a module
refbind by reference in a patternavoid moving during pattern matching
movecapture by valuetransfer ownership into closure or thread
asyncasync method markerfunction returns a future
awaitfuture completion pointsuspend until result is ready
unsafedangerous low-level blockprogrammer must uphold invariants
wheregeneric bounds clausemove trait bounds out of the angle brackets
Selfcurrent class typecurrent implementing type
dyninterface referencedynamic dispatch through a trait object
constcompile-time constantinlined immutable value
staticstatic fieldprocess-wide storage

Three Keywords That Need Extra Attention

mut

Mutability is explicit on the binding:

#![allow(unused)]
fn main() {
let x = 1;
let mut y = 2;
y += 1;
}

match

match is not just a switch statement. It is a pattern-matching expression and must usually cover every case.

move

Java developers often underestimate move. In Rust it matters whenever values enter closures, threads, or async tasks.

Keep this table nearby during the first pass through the book. After a few chapters, most of these keywords become second nature.