Rust Cheat Sheet

Last Updated: November 21, 2025

Variables

fn main() {
    let x = 5; // Immutable
    let mut y = 10; // Mutable
    println!("x: {}, y: {}", x, y);
}

Ownership

let x = value
Transfer ownership
&x
Borrow (immutable)
&mut x
Mutable borrow
💡 Pro Tip: Read compiler error messages carefully - they're very helpful!
← Back to Programming Languages | Browse all categories | View all cheat sheets