rust-memory-and-state
Installation
SKILL.md
Rust Memory and State
Use this when the question is really "who owns this, who may mutate it, and how long must it stay valid?"
Working stance
- Prefer one clear owner and cheap borrowed reads.
- Reach for cloning last, not first.
- If cloning appears mainly to placate the borrow checker, fix the data flow before keeping the clone.
- Treat
Rc,Arc,RefCell,Mutex, andRwLockas ownership decisions, not syntax bandages. - If a lifetime gets hard to express, ask whether the type should own the data.
- Use RAII to make cleanup happen by scope, not by hope.