Rust Coroutine
协程与绿色线程专家。处理 generator, suspend/resume, stackful coroutine, stackless coroutine, context switch, 协程, 绿色线程, 上下文切换, 生成器--- # 协程与绿色线程 ## 核心问题 如何实现高效的轻量级并发? 协程提供用户态的上下文切换,避免内核线程的开销。
Install
npx skills add huiali/rust-skills --skill rust-coroutinegit clone --depth 1 https://github.com/huiali/rust-skills.git /tmp/rust-skills
mkdir -p ~/.claude/skills
cp -r /tmp/rust-skills/.codex/skills/rust-coroutine ~/.claude/skills/rust-coroutinePersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
## 协程 vs 线程
| 特性 | OS 线程 | 协程 |
|-----|--------|------|
| 调度 | 内核 | 用户态 |
| 切换开销 | ~1μs | ~100ns |
| 数量限制 | 数千 | 数十万 |
| 栈大小 | 1-8MB | 几 KB |
| 抢占 | 抢占式 | 协作式 |
## Rust 原生 Generator
```rust
// Rust Nightly 的 generator
#![feature(generators)]
#![feature(generator_trait)]
use std::ops::Generator;
fn simple_generator() -> impl Generator<Yield = i32, Return = ()> {
|| {
yield 1;
yield 2;
yield 3;
// Generator 完成
}
}
fn main() {
let mut gen = simple_generator();
loop {
match unsafe { Pin::new_unchecked(&mut gen).resume() } {
GeneratorState::Yielded(v) => println!("Yielded: {}", v),
GeneratorState::Complete(()) => {
println!("Done!");
break;
}
}
}
}
```
## 栈式协程 (Stackful Coroutine)Details
- Skill name
rust-coroutine- Repository
- huiali/rust-skills
- Path
.codex/skills/rust-coroutine/SKILL.md- License
- MIT
- Repo updated
- 9 February 2026
FAQ
What does the Rust Coroutine skill do?
协程与绿色线程专家。处理 generator, suspend/resume, stackful coroutine, stackless coroutine, context switch, 协程, 绿色线程, 上下文切换, 生成器--- # 协程与绿色线程 ## 核心问题 **如何实现高效的轻量级并发?** 协程提供用户态的上下文切换,避免内核线程的开销。
How do I install the Rust Coroutine skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add huiali/rust-skills --skill rust-coroutine. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Rust Coroutine popular?
It lives in huiali/rust-skills, which has 49 GitHub stars and 7 forks.
Related skills
Rust Actor
49huiali/rust-skills
Actor model expert covering message passing, state isolation, supervision trees, deadlock prevention, fault tolerance, Actix framework, and Erlang-style concurrency patterns.
Rust Anti Pattern
49huiali/rust-skills
Rust anti-patterns and common mistakes expert. Handles code review issues with clone abuse, unwrap in production, String misuse, index loops, and refactoring guidance.
Rust Async
49huiali/rust-skills
Advanced async patterns expert. Handles Stream processing, backpressure control, select/join operations, cancellation, Future trait implementation, and async runtime optimization.
Rust Distributed
49huiali/rust-skills
分布式系统专家。处理 Raft, 2PC, 共识算法, 分布式事务, 分布式一致性, 分布式协调--- # 分布式系统 ## 核心问题 **如何在分布式环境中实现数据一致性和高可用?** 分布式系统需要在CAP理论中做出权衡。
Rust Const
49huiali/rust-skills
Const generics and compile-time computation expert covering const fn, type-level computation, const evaluation, MaybeUninit arrays, and compile-time validation.
Rust Dpdk
49huiali/rust-skills
用户态网络专家。处理 DPDK, 用户态驱动, 高性能网络, packet processing, 零拷贝, RSS 负载均衡--- # 用户态网络 (DPDK) ## 核心问题 **如何实现百万级 PPS 的高性能网络数据包处理?** 传统内核网络栈有太多上下文切换和内存拷贝开销。
Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.