coroutine 0.5.0

Coroutine Library in Rust
docs.rs failed to build coroutine-0.5.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: coroutine-0.8.0

coroutine-rs

Build Status crates.io crates.io

Coroutine library in Rust

[dependencies.coroutine]
git = "https://github.com/rustcc/coroutine-rs.git"

Usage

Basic usage of Coroutine

extern crate coroutine;

use coroutine::asymmetric::Coroutine;

fn main() {
    let coro: Coroutine<i32> = Coroutine::spawn(|me| {
        for num in 0..10 {
            me.yield_with(num);
        }
    });

    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

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

  • Currently this crate can only be built with Rust nightly because of some unstable features.

  • 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)