actionbook avatar

M14 Mental Model

A learning guide that maps core Rust concepts to mental models, analogies, and common compiler-error misconceptions.

skills.sh installs
3.6K
GitHub stars
1.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers ownership, borrowing, lifetimes, and smart pointers, each paired with a plain-language analogy
  • Includes a table of common misconceptions by error code (E0382, E0502, E0499, E0106, E0507) with corrected models
  • Adds comparisons for developers coming from Java, C/C++, Python, Go, and JavaScript, plus stack and heap diagrams
  • Designed for developers learning Rust who need intuition for why the borrow checker rejects code

Install

$ npx -y skills add actionbook/rust-skills --skill m14-mental-model -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Mental Models

Layer 2: Design Choices

Core Question

What's the right way to think about this Rust concept?

When learning or explaining Rust:

  • What's the correct mental model?
  • What misconceptions should be avoided?
  • What analogies help understanding?

Key Mental Models

ConceptMental ModelAnalogy
OwnershipUnique keyOnly one person has the house key
MoveKey handoverGiving away your key
&TLending for readingLending a book
&mut TExclusive editingOnly you can edit the doc
Lifetime 'aValid scope"Ticket valid until..."
Box<T>Heap pointerRemote control to TV
Rc<T>Shared ownershipMultiple remotes, last turns off
Arc<T>Thread-safe RcRemotes from any room

Coming From Other Languages

FromKey Shift
Java/C#Values are owned, not references by default
C/C++Compiler enforces safety rules
Python/GoNo GC, deterministic destruction
FunctionalMutability is safe via ownership
JavaScriptNo null, use Option instead

Thinking Prompt

Details

Repository
github.com/actionbook/rust-skills
Categories
Rust, Learning & Teaching
First seen
May 16, 2026

More from actionbook/rust-skills

All 38

Similar to M14 Mental Model

More Rust