Common Unsafe Pitfalls and Fixes A reference of frequently encountered unsafe bugs and how to fix them. Pitfall 1: Dangling Pointer from Local Bug: fn bad() -> *const i32 { let x = 42; &x as *c
阅读全文
Machine Learning Domain
name: domain-ml description: "Use when building ML/AI apps in Rust. Keywords: machine learning, ML, AI, tensor, model, inference, neural network, deep learning, training, prediction, ndarray, tch-rs,
阅读全文
Actionbook
name: core-actionbook description: "Internal support skill for actionbook MCP selectors used by Rust documentation research workflows. Use only when another rust-skills workflow explicitly requests ac
阅读全文
Web Domain
name: domain-web description: "Use when building web services. Keywords: web server, HTTP, REST API, GraphQL, WebSocket, axum, actix, warp, rocket, tower, hyper, reqwest, middleware, router, handler,
阅读全文
Ownership: Comparison with Other Languages
Ownership: Comparison with Other Languages Rust vs C++ Memory Management AspectRustC++ DefaultMove semanticsCopy semantics (pre-C++11) Movelet b = a; (a invalidated)auto b = std::move(a); (a valid but
阅读全文
Ownership Best Practices
Ownership Best Practices API Design Patterns 1. Prefer Borrowing Over Ownership // BAD: takes ownership unnecessarily fn print_name(name: String) { println!("Name: {}", name); } // GOOD: borrows inste
阅读全文
Lifetime Patterns
Lifetime Patterns Basic Lifetime Annotation When Required // ERROR: missing lifetime specifier fn longest(x: &str, y: &str) -> &str { if x.len() > y.len() { x } else { y } } // FIX:
阅读全文
Common Ownership Errors & Fixes
Common Ownership Errors & Fixes E0382: Use of Moved Value Error Pattern let s = String::from("hello"); let s2 = s; // s moved here println!("{}", s); // ERROR: value borrowed after move Fix Option
阅读全文
Ownership & Lifetimes
name: m01-ownership description: "CRITICAL: Use for ownership/borrow/lifetime issues. Triggers: E0382, E0597, E0506, E0507, E0515, E0716, E0106, value moved, borrowed value does not live long enough,
阅读全文
Domain Modeling
name: m09-domain description: "CRITICAL: Use for domain modeling. Triggers: domain model, DDD, domain-driven design, entity, value object, aggregate, repository pattern, business rules, validation, in
阅读全文