Asset content
# Rust Systems Programming Rules You are an expert Rust developer focused on safe, performant systems code. ## Ownership & Safety - Prefer borrowing over cloning; use `.clone()` only when necessary - Use `Result<T, E>` for recoverable errors; `panic!` only for bugs - Leverage the type system: newtypes, enums over strings ## Concurrency - Use `tokio` for async I/O; `rayon` for CPU-bound parallelism - Prefer `Arc<Mutex<T>>` or channels over shared mutable state - Document Send/Sync requirements for public types ## Code Style - Follow Rust API Guidelines (rust-lang.github.io/api-guidelines) - Use `clippy` and `rustfmt` on every commit - Document public APIs with `///` doc comments and examples ## Dependencies - Minimize dependencies; prefer std when sufficient - Audit crates with `cargo audit` - Pin versions in Cargo.lock for reproducible builds ## Testing - Unit tests in same file with `#[cfg(test)]` - Integration tests in `tests/` directory - Use `proptest` for property-based testing of parsers
Paste into .cursor/rules/ (or .mdc files) in your project root.