算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
rust-ownership-borrowing【设计与创意】Design and review Rust ownership, borrowing, lifetimes, and interior mutability so data flow matches the domain model. Use when writing, refactoring, or reviewing Rust code that hits move, borrow checker, aliasing, Clone, Copy, Rc, Arc, RefCell, or lifetime problems.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill to make ownership shape match the program's data flow. Treat borrow-checker errors as design feedback: decide who owns each value, how long access must last, and whether mutation needs exclusivity or a different data shape.
Rc<RefCell<_>>.Rc for single-threaded shared ownership and Arc for cross-thread
shared ownership. Add Cell, RefCell, Mutex, or RwLock only when the
mutation model is explicit.T when the function consumes or stores the value.&T when the function only reads during the call.&mut T when the function must mutate and no other access should occur.&Vec<T>, &String, or &PathBuf when &[T], &str, or
&Path expresses the needed capability.Read references/borrow-patterns.md when resolving non-trivial compiler
errors or reviewing a borrow-heavy patch.
Option::take, std::mem::take, or std::mem::replace to move a field
out while leaving a valid value behind.split_at_mut, get_mut, entry, drain, and
retain instead of indexing patterns that create overlapping borrows.Arc, Rc, and cheap IDs freely when that is the intended
ownership handle; avoid cloning payloads to silence the compiler.Clone is deliberate and tested for semantic independence where relevant.Arc plus the right synchronization primitive;
Rc and RefCell stay out of cross-thread paths.