📖 About Rust
Rust is a modern systems programming language focused on safety, speed, and concurrency. It guarantees memory safety without garbage collection through its unique ownership system. Rust excels at building reliable and efficient software, from operating systems to web servers.
🎯 Best For
- Systems programming and operating systems
- High-performance web services
- Embedded systems and IoT
- Command-line tools and utilities
- WebAssembly applications
🔧 Key Features
- Ownership system for memory safety
- Zero-cost abstractions
- Fearless concurrency with Send/Sync traits
- Pattern matching and algebraic data types
- Cargo package manager and build system
- Powerful type system with generics
🛠️ Development Tools
Build
cargo build
Test
cargo test
Coverage
cargo tarpaulin --out Html
Run
cargo run
📄 Package Contents (7 files)
AGENTS_RULES.md
Complete AI agent rules (universal)
- RUST-specific best practices
- TDD workflow (Red-Green-Refactor)
- DDD principles and patterns
- Git workflow and commit format
- Code quality principles
.cursorrules
Quick reference for Cursor IDE
- Essential rules summary
- Links to full documentation
- Optimized for quick loading
.gitignore
Git exclusions
- RUST-specific patterns
- Build artifacts
- IDE configuration files
- Dependency directories
AGENTS.md
Quick reference guide
- Common patterns
- Best practices summary
- Quick troubleshooting
README.md
Project template with examples
- Setup instructions
- Sample code and structure
- Testing examples
- Build and run commands
CODE_QUALITY_PRINCIPLES.md
Quality principles and best practices
- Avoid default values (fail-fast)
- Consistency across code paths
- Extract reusable functions
- RUST-specific examples
CONTRIBUTING.md
Contribution guidelines
- TDD workflow (Red-Green-Refactor)
- Git commit format
- Code review process
- Testing requirements (90% coverage)
💻 Code Examples
Ownership & Borrowing
fn main() {
let s1 = String::from("hello");
let len = calculate_length(&s1);
println!("Length of '{}' is {}.", s1, len);
}
fn calculate_length(s: &String) -> usize {
s.len()
}
Result Pattern
use std::fs::File;
use std::io::Read;
fn read_file(path: &str) -> Result<String, std::io::Error> {
let mut file = File::open(path)?;
let mut contents = String::new();
file.read_to_string(&mut contents)?;
Ok(contents)
}
match read_file("config.txt") {
Ok(content) => println!("File: {}", content),
Err(e) => eprintln!("Error: {}", e),
}
Traits & Generics
trait Summary {
fn summarize(&self) -> String;
}
struct Article {
title: String,
content: String,
}
impl Summary for Article {
fn summarize(&self) -> String {
format!("{}: {}...", self.title, &self.content[..50])
}
}