rust-memory-safety
Rust memory safety, ownership and borrow checker patterns, error handling with Result/Option, and traits.
SKILL.mdskills/rust-memory-safety/SKILL.md
GitHubRust Architecture & Memory Safety Protocol
Author high-performance, memory-safe software with zero-cost abstractions.
1. Ownership & Borrowing
- Prefer borrowing (
&T,&mut T) over cloning (.clone()) unless transfer of ownership is explicitly required. - Structure data to avoid cyclic references that require
Rc<RefCell<T>>.
2. Idiomatic Error Handling
Use Result<T, E> with the ? operator. Create custom error enums with thiserror for internal crates.