ClaudeRustPerformance

Rust Claude Rules

Claude rules for Rust: zero-cost abstractions, async with Tokio, error types, and high-performance Rust patterns.

CLAUDE.md
- Use Tokio for async runtime; prefer async-std only for WASM compatibility
- Design error types with thiserror; implement From for error conversion chains
- Use Arc<Mutex<T>> only when needed; prefer message passing with channels
- Leverage Rust's zero-cost iterator abstractions; avoid collecting needlessly
- Use cargo-flamegraph to profile; measure allocations with cargo-heaptrack
- Enable LTO and set codegen-units = 1 in release profile for max performance
- Write property-based tests with proptest for complex invariants
- Use cargo-fuzz for security-sensitive parsing and deserialization code

How to use with Claude

Create a `CLAUDE.md` file in your project root. Claude Code reads this on startup and follows your conventions throughout the session.

#rust#tokio#async#claude#coding-rules

Related Rules