rust-basics

A set of Rust development rules for memory-safe systems programming and high-performance applications. It covers Cargo, compiler warnings, documentation, error messages, and links to separate rules for ownership, types, and practices.

In plain words
What is it for?
Use it when building Rust systems, network services, distributed software, embedded programs, WebAssembly, blockchain code, or other Cargo projects.
Why use it?
It provides shared conventions for Rust projects where memory safety, thread safety, dependency management, and performance matter.

Cursor rule for Cursor

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.

agentmods
npx agentmods add rules/wangqiqi/cursor-ai-rules/rust-basics
Clone the repo
git clone --depth 1 https://github.com/wangqiqi/cursor-ai-rules

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 310 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.00310
Opus 5 $0.00000 $0.00155
Sonnet 5 $0.00000 $0.00062
Haiku 4.5 $0.00000 $0.00031

Measured 2d ago against content hash d49c0aac6c4d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rust-basics 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 2d 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.

.cursor/rules/tech/rust-basics.mdc · 35 lines

What it actually says

🦀 Rust 开发规则

版本: v4.4.0 | 已拆分所有权/类型/实践至独立规则

⚠️ 执行原则

  • MUST 确保内存安全和线程安全
  • NEVER 忽略编译器警告
  • ALWAYS 使用 Cargo 进行依赖管理
  • DO NOT 泄漏敏感信息到错误消息
  • MUST 编写清晰的文档注释

🎯 适用场景

  • 系统级编程、高性能计算
  • 网络服务、分布式系统
  • 嵌入式、WebAssembly、区块链

📚 详细规范引用

  • 所有权:见 @rust-basics-ownership(借用、生命周期、Rc/Arc)
  • 类型系统:见 @rust-basics-types(错误处理、泛型、特征、异步)
  • 实践:见 @rust-basics-practices(项目结构、Cargo、依赖管理)

引用: @rust-basics-ownership @rust-basics-types @rust-basics-practices

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. 2d ago First seen · 35 lines · 0 tokens per session scan A d49c0aac6c4d

Subscribe to this mod's changes

rust-basics is a cursor rule published in the GitHub repository wangqiqi/cursor-ai-rules (15 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 310 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-08-30.