Cheatsheet: Rust
Last updated 2026-08-15
Variables and Types
Immutable and mutable bindings
Common scalar and compound types
Shadowing
Control Flow
if expression
match
loop / while / for
Ownership and Borrowing
Move semantics
Borrow with references
Mutable borrowing
Rule of thumb
Structs and Enums
Struct
impl block
Enum with match
Traits
Define and implement a trait
Trait bounds
Error Handling
Option
Result and match
? operator
Collections
Vec
HashMap
Iterate