Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

rustcc/coroutine-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

219 Commits

Repository files navigation

coroutine-rs

Build Status crates.io crates.io

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)

About

Coroutine Library in Rust

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 12

Languages

AltStyle によって変換されたページ (->オリジナル) /