Master Rust 1.75+ development with async runtime (Tokio/smol).
Goal: Write idiomatic, high-performance, and memory-safe Rust code following standard community practices (The Rust Way).
.clone() unless necessary. Use Arc<Mutex<T>> or RwLock<T> for shared state only when message passing (mpsc) is not viable.Result<T, E> with thiserror for libraries and anyhow for applications. Never use .unwrap() in production code; use .expect() with a context message or ? operator.tokio for general purpose apps. Use join_all for parallel execution of futures.New Type pattern to enforce validation at compile time.cargoclippy (Treat warnings as errors in CI)rustfmt#[test] and cargo test. Use mockall for mocking traits.my_crate/
├── Cargo.toml
├── src/
│ ├── main.rs # Binary entry point
│ ├── lib.rs # Library entry point
│ ├── bin/ # Additional binaries
│ ├── models/ # Data structures
│ ├── error.rs # Central error definition
│ └── utils.rs # Helper functions
└── tests/ # Integration tests
└── integration_test.rs
tokio, futuresaxum or actix-webserde, serde_jsonanyhow, thiserrortracing, tracing-subscriberconfig crate for environment managementString only when ownership is needed; prefer &str for function arguments.unsafe blocks unless absolutely necessary and documented with // SAFETY: comment explaining why it holds.Vec::with_capacity(n) if size is known.struct and enum definitions.main.rs or lib.rs.tests/.Anti-Patterns to Avoid:
Box<dyn Trait> (prefer generics with static dispatch).Result (always handle or propagate).