rust-development

rust-development is a cursor rule for Cursor from adonai-labs/agent-runway. It costs 0 tokens per session (1,724 once invoked), scanned A, original, MIT.

Rust development guidance covering ownership, borrowing, lifetimes, error handling, performance, concurrency, asynchronous code, and testing.

In plain words
What is it for?
Use it when writing or reviewing Rust code involving ownership, references, lifetimes, concurrent tasks, asynchronous operations, or tests.
Why use it?
It helps developers work with Rust's rules for memory safety and concurrency while avoiding unnecessary copies and difficult-to-maintain code.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it when writing or reviewing Rust code involving ownership, references, lifetimes, concurrent tasks, asynchronous operations, or tests.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/adonai-labs/agent-runway/rust-development
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/adonai-labs/agent-runway

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rust-development

README.md
[![agentmods](https://agentmods.dev/badge/rules/adonai-labs/agent-runway/rust-development.svg)](https://agentmods.dev/rules/adonai-labs/agent-runway/rust-development)
Your own site
<a href="https://agentmods.dev/rules/adonai-labs/agent-runway/rust-development"><img src="https://agentmods.dev/badge/rules/adonai-labs/agent-runway/rust-development.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,724 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01724
Opus 5 $0.00000 $0.00862
Sonnet 5 $0.00000 $0.00345
Haiku 4.5 $0.00000 $0.00172

Measured 3d ago against content hash 0beda4b19307, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

rust-development scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/stacks/rust/rust-development.mdc · 137 lines

How it starts

The opening of the file, as written. The whole thing — 137 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Rust Development Guidelines

Directives for Rust development. Apply when working with .rs files or Cargo.toml.


Ownership and Borrowing

  • Prefer borrowing over moving when the caller needs the value afterwards; use &T or &mut T.
  • Move by default when transferring ownership; assignment moves for non-Copy types.
  • Clone only when necessary — cloning is explicit and can be expensive; prefer references.
  • Use &str over &String for function parameters when you only need to read.
  • Return owned values from functions when the caller should own the result; avoid returning references to local data.
  • Borrow mutably (&mut T) only when you need to modify; avoid overlapping mutable borrows.
  • Use into_iter() when consuming a collection; use iter() when you need references.
  • Do not return references to temporary or stack-allocated data.
let s1 = String::from("hello");
let s2 = s1;   // move; s1 invalid
let s3 = &s2;  // borrow; s2 still valid

Lifetimes

  • Add explicit lifetimes when the compiler cannot infer them (e.g. function returns a reference derived from parameters).
  • Rely on elision when the rules apply: one input ref → output ref gets that lifetime; one &self/&mut self → output ref gets that lifetime.
  • Use 'static only for data that lives for the whole program; avoid for general-purpose APIs.
  • Structs holding references need lifetime parameters: struct Excerpt<'a> { part: &'a str }.
  • Prefer owned types when lifetimes make the API complex; sometimes String is simpler than &str in public APIs.

Smart Pointers

  • Box<T> — Single ownership, heap allocation; use for recursive types, large values, or trait objects.
  • Rc<T> — Shared ownership, single-threaded; use when multiple owners need the same value (e.g. graphs, shared config).
  • Arc<T> — Thread-safe shared ownership; use when sharing across threads; pair with Mutex or RwLock for mutability.
  • Avoid Rc/Arc when possible — they add overhead; prefer borrowing or owned values when ownership is clear.

Read the full file on GitHub · 137 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 137 lines · 0 tokens per session scan A 0beda4b19307

Subscribe to this mod's changes

rust-development is a cursor rule published in the GitHub repository adonai-labs/agent-runway (2 stars, last pushed 17d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,724 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.