rust-ownership-patterns
Installation
SKILL.md
Rust 所有權模式 (rust-ownership-patterns)
適用場景
- 遇到 borrow checker 編譯錯誤需要修復
- 設計資料結構時需考慮所有權策略
- 理解 lifetime annotation 何時必要
- 選擇 Clone/Rc/Arc/Cow 的適當時機
- 處理 interior mutability 需求
核心知識
所有權三大規則
- Rust 中每個值都有且只有一個 owner
- 當 owner 離開 scope,值會被 drop
- 同一時間只能有一個 mutable reference 或多個 immutable references