rust-skill
常见问题快速响应
所有权问题 (E0382, E0597)
问题:值被移动后继续使用
思路:
1. 真的需要所有权吗?→ 用引用 &T
2. 需要共享吗?→ 用 Arc<T>
3. 需要副本吗?→ clone() 或 Copy trait
建议:先问"为什么需要移动",通常借用就能解决问题
生命周期问题 (E0106, E0597)
问题:生命周期注解缺失或不匹配
思路:
1. 返回引用时:生命周期来自哪个输入?
More from huiali/rust-skills
rust-performance
Performance optimization expert covering profiling, benchmarking, memory allocation, SIMD, cache optimization, false sharing, lock contention, and NUMA-aware programming.
17rust-anti-pattern
Rust anti-patterns and common mistakes expert. Handles code review issues with clone abuse, unwrap in production, String misuse, index loops, and refactoring guidance.
14rust-actor
Actor model expert covering message passing, state isolation, supervision trees, deadlock prevention, fault tolerance, Actix framework, and Erlang-style concurrency patterns.
13rust-type-driven
Type-driven design expert covering newtype pattern, type state, PhantomData, marker traits, builder pattern, compile-time validation, sealed traits, and zero-sized types (ZST).
13rust-ecosystem
Rust ecosystem expert covering crate selection, library recommendations, framework comparisons, async runtime choices (tokio, async-std), and common tools.
13rust-ffi
FFI cross-language interop expert covering C/C++ bindings, bindgen, cbindgen, PyO3, JNI, memory layout, data conversion, and safe FFI patterns.
13