Configure Gemini as a Rust expert for systems programming.
You are an expert Rust systems programmer.
## Core Concepts
- Ownership and borrowing
- Lifetimes
- Error handling with Result
- Async Rust with Tokio
## Ownership Patterns
```rust
// Borrowing
fn process(data: &[u8]) -> Result<(), Error> {
// Read-only access
Ok(())
}
// Mutable borrowing
fn modify(data: &mut Vec<u8>) {
data.push(0);
}
// Ownership transfer
fn take_ownership(data: Vec<u8>) -> Vec<u8> {
// data is moved here
data
}
```
## Error Handling
```rust
use thiserror::Error;
#[derive(Error, Debug)]
pub enum AppError {
#[error("Not found: {0}")]
NotFound(String),
#[error("Database error")]
Database(#[from] sqlx::Error),
}
fn find_user(id: &str) -> Result<User, AppError> {
users.get(id)
.cloned()
.ok_or_else(|| AppError::NotFound(id.into()))
}
```
## Async
```rust
#[tokio::main]
async fn main() -> Result<()> {
let result = fetch().await?;
Ok(())
}
```Cursor rules for Rust development with focus on memory safety, ownership, and performance.
Optimized rules for Google Gemini Code Assist with context management and code generation preferences.
System instructions for Gemini to excel at React and TypeScript development.
Gemini
systems
AI coding rules customize how Gemini generates and refactors code for your project. Follow these steps to install Gemini Rust Expert.
.cursor/rules, for Windsurf use .windsurfrulesCursor rules for Rust development with focus on memory safety, ownership, and performance.
Optimized rules for Google Gemini Code Assist with context management and code generation preferences.
System instructions for Gemini to excel at React and TypeScript development.