huiali/rust-skills/rust-linear-type
Claude Code and agent skill by huiali/rust-skills
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
线性类型与资源管理专家。处理 Destructible, 资源清理, RAII, unique object, linear semantics, 线性语义, 资源所有权, 独占语义--- # 线性类型 ## 核心问题 **如何保证资源不被泄漏或被重复释放?** 线性类型语义保证每个资源被精确使用一次。
Install
npx vskill@latest install huiali/rust-skills/rust-linear-typeSKILL.md
线性类型 vs Rust 所有权
| 特性 | Rust 所有权 | 线性类型 | |
|---|---|---|---|
| 移动语义 | ✓ | ✓ | |
| 复制语义 | 可选 | ✗ | |
| 析构保证 | Drop | Destructible | |
| 借用 | ✓ | ✗ 或受限 | |
| 多重所有 | Rc/Arc | ✗ |
Rust 默认不是线性类型,但可以通过模式实现线性语义。
Destructible Trait
独占对象模式
资源令牌模式
交易式资源管理
Unique 指针模式
Rust 中的线性语义场景
| 场景 | 线性保证 | 模式 | |
|---|---|---|---|
| 文件句柄 | close 恰好一次 | RAII + Drop | |
| 网络连接 | close 恰好一次 | RAII + Drop | |
| 内存分配 | free 恰好一次 | RAII + Drop | |
| 锁 | unlock 恰好一次 | RAII + Drop | |
| 事务 | commit 或 rollback | 交易式资源管理 | |
| FFI 资源 | release 恰好一次 | 资源令牌 |
避免的模式
| 反模式 | 问题 | 正确做法 | |
|---|---|---|---|
| Clone 允许复制 | 破坏线性语义 | 使用 move 语义 | |
| Rc/Arc 共享 | 多重所有 | 线性令牌 | |
| 手动管理生命周期 | 容易出错 | RAII + Drop | |
| 跳过 Drop | 资源泄漏 | 使用 scope API |
与其他技能关联
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/rust-linear-type/SKILL.md
Popularity
- Repository stars
- 20
- Repository forks
- 4
- 7-day trend score
- 15
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 21 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/huiali/rust-skills/rust-linear-type)