coding-rust
Installation
SKILL.md
coding-rust
Purpose
This skill provides expertise in advanced Rust programming, focusing on core language features and ecosystem tools to build efficient, safe systems code.
When to Use
- When implementing memory-safe code with ownership, borrowing, or lifetimes to prevent common errors like data races.
- For projects requiring asynchronous programming with Tokio, error handling via anyhow/thiserror, or managing multi-crate setups with Cargo workspaces.
- In scenarios involving unsafe code for performance-critical sections, or defining custom behaviors with traits.
Key Capabilities
- Manage Rust's ownership model: Use references (&T) and lifetimes ('a) to borrow data without transferring ownership.
- Implement traits: Define and use trait objects for polymorphism, e.g.,
trait Debug { fn fmt(&self); }. - Handle async with Tokio: Run asynchronous tasks using
tokio::mainand futures. - Error management: Leverage anyhow for simple error wrapping and thiserror for custom error types.
- Cargo workspaces: Organize multi-package projects with
Cargo.tomlworkspaces for dependency sharing. - Unsafe operations: Use unsafe blocks for raw pointers or FFI, ensuring safety invariants are maintained.