typeshit/slug icon
public
Published on 6/13/2025
rust

Rules
Models
Context
relace Relace Instant Apply model icon

Relace Instant Apply

relace

40kinput·32koutput
anthropic Claude 3.7 Sonnet model icon

Claude 3.7 Sonnet

anthropic

200kinput·8.192koutput
anthropic Claude 3.5 Sonnet model icon

Claude 3.5 Sonnet

anthropic

200kinput·8.192koutput
mistral Codestral model icon

Codestral

mistral

voyage voyage-code-3 model icon

voyage-code-3

voyage

voyage Voyage AI rerank-2 model icon

Voyage AI rerank-2

voyage

# AI Rules for Rust Code Generation
- Prioritize Idiomatic Rust: Generate code that strictly adheres to Rust's official style guidelines (`rustfmt`), conventions, and best practices. Utilize standard library types and features effectively (e.g., `Option`, `Result`, iterators, pattern matching).
- Emphasize Safety and Concurrency: Leverage Rust's core strengths. Explain ownership, borrowing, and lifetimes when relevant. When dealing with concurrency, use safe abstractions like `Arc`, `Mutex`, and async/await patterns correctly.
- Focus on Performance: Generate efficient code. Explain performance implications or trade-offs where relevant (e.g., heap vs. stack allocation, choice of collections).
- Robust Error Handling: Use `Result<T, E>` for recoverable errors. Avoid `panic!` unless absolutely necessary (e.g., unrecoverable state, invariants). Clearly define custom error types if needed.
- Modern Rust: Utilize features from the latest stable Rust edition. Prefer standard library solutions over external crates unless the crate provides significant, necessary functionality.
- Native Application Context: Assume the target is a native desktop or server application unless explicitly stated otherwise (e.g., WASM).
- Provide Explanations: Briefly explain why specific patterns or constructs are used, especially those unique to Rust (like the borrow checker's impact).
- Complete and Runnable Code: When providing examples or solutions, include necessary `use` statements, type definitions, and potentially a minimal `main` function or test case to demonstrate usage. If external crates are used, mention the required `Cargo.toml` entries.
- Clarity and Maintainability: Write clear, well-commented code with meaningful names.
Rust docshttps://doc.rust-lang.org/book/

Prompts

Learn more

No Prompts configured

Context

Learn more
@diff
Reference all of the changes you've made to your current branch
@codebase
Reference the most relevant snippets from your codebase
@url
Reference the markdown converted contents of a given URL
@folder
Uses the same retrieval mechanism as @Codebase, but only on a single folder
@terminal
Reference the last command you ran in your IDE's terminal and its output
@code
Reference specific functions or classes from throughout your project
@file
Reference any file in your current workspace

No Data configured

MCP Servers

Learn more

No MCP Servers configured