back
loading skill details...
CRITICAL: Use for smart pointers and resource management. Triggers: Box, Rc, Arc, Weak, RefCell, Cell, smart pointer, heap allocation, reference counting,…
Smart pointer and resource ownership patterns for Rust heap allocation and reference counting. Guides ownership decisions through a three-step model: single vs. shared ownership, single-threaded vs. multi-threaded context, and presence of reference cycles Covers six core types (Box, Rc, Arc, Weak, Cell, RefCell) with a decision flowchart and quick reference table for choosing the right pattern Includes common errors and anti-patterns with fixes, such as using Weak to break cycles, avoiding unnecessary Arc overhead, and preventing RefCell panics Traces design questions upward to concurrency and mutability concerns, and downward to concrete implementation choices Resource Management Layer 1: Language Mechanics Core Question What ownership pattern does this resource need? Before choosing a smart pointer, understand: Is ownership single or shared? Is access single-threaded or multi-threaded? Are there potential cycles? Error → Design Question
don't have the plugin yet? install it then click "run inline in claude" again.