• Stars
    star
    414
  • Rank 104,550 (Top 3 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Coroutine Library in Rust

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)

More Repositories

1

writing-an-os-in-rust

《使用Rust编写操作系统》
Rust
2,162
star
2

RustPrimer

The Rust primer for beginners. We need native English speaker help us modify the translation.
Rust
1,767
star
3

awesome-rust

Rust框架、库和资源的汇总, Rust中文社区
1,023
star
4

rust-zh

Rust中文社区开源项目:Rust编程语言官方文档中文化
721
star
5

RustChinaConf2020

All pdf slides in RustChinaConf2020
296
star
6

Rust_Atomics_and_Locks

Rust Atomics and Locks (中文翻译)
SCSS
248
star
7

rust-slides

The collections of rust slides
C
148
star
8

forustm

A forum for rust community, using Rust, and Sapper.
Rust
90
star
9

2022RustChinaCnf-ppts

2022RustChinaCnf-ppts
72
star
10

TTstack

A private-cloud solution for SMEs !
Rust
53
star
11

lernaean-deploy

deploy scripts for lernaean
Shell
48
star
12

hackathon2022

hackathon2022 for rustcc
Rust
30
star
13

lernaean

Lernaean是一个crates.io的镜像,寓意生生不息。
Rust
24
star
14

When-Rust-Meets-Computer-Graphics

一个浅显易懂的Rust GFX-HAL 教程
19
star
15

Rust-Events

Rust meetups, conferences resources
17
star
16

GEFS

Game Engine From Scratch -- Rust China Conference 2020 topic by LemonHX and his team.
Rust
14
star
17

rustchinaconf2024-slides

rustchinaconf2024-slides
13
star
18

dust

a GUI framework for Windows, written in Rust programming language
Rust
10
star
19

WagerRust

打赌帖,五年后 (2021-05-06) Rust 是否会达到 Go 今天在中国那样的热度?——2016-05-06
7
star
20

RustFAQ

6
star
21

borrowchecker

A Rust and Withoutgc site like stackoverflow.com.
Rust
5
star
22

concurrent_adaptive_radix_tree

Applies the fastest ART with concurrency and SIMD
Rust
5
star
23

libseccomp-rs

A mid-level binding to libseccomp
Rust
3
star
24

irccc

An irc service for rustcc by rust.
Rust
2
star