项目
在 GitHub 查看
rustcc/coroutine-rs
关于
Rust 协程库
开发工具实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文coroutine-rs
Coroutine library in Rust
[dependencies]
coroutine = "0.8"
Usage
Basic usage of Coroutine
extern crate coroutine;
use std::usize;
use coroutine::asymmetric::Coroutine;
fn main() {
let coro: Coroutine<i32> = Coroutine::spawn(|me,_| {
for num in 0..10 {
me.yield_with(num);
}
usize::MAX
});
for num in coro {
println!("{}", num.unwrap());
}
}
This program will print the following to the console
0
1
2
3
4
5
6
7
8
9
18446744073709551615
For more detail, please run cargo doc --open.
Goals
Basic single threaded coroutine support
Asymmetric Coroutines
Symmetric Coroutines
Thread-safe: can only resume a coroutine in one thread simultaneously
Notes
Basically it supports arm, i686, mips, mipsel and x86_64 platforms, but we have only tested in
OS X 10.10.*, x86_64, nightly
ArchLinux, x86_64, nightly
Thanks
- The Rust developers (context switch ASM from libgreen)
探索相关项目
加载中…