greenthread-future

Crates.iogreenthread-future
lib.rsgreenthread-future
version0.1.0
sourcesrc
created_at2020-02-02 07:48:46.137216
updated_at2020-02-02 07:48:46.137216
descriptionConvert closures to futures based on greenthread on bare-metal (no_std + no_alloc).
homepagehttps://github.com/wangrunji0408/greenthread-future-rs
repositoryhttps://github.com/wangrunji0408/greenthread-future-rs
max_upload_size
id204159
size56,242
Runji Wang (wangrunji0408)

documentation

https://docs.rs/greenthread-future

README

greenthread-future-rs

Actions Status Coverage Status

Convert closures into futures based on greenthread on bare-metal (no_std + no_alloc).

In a word, this is a #![no_std] version of Futurify.

I'm exploring to use it to implement bare-metal threading.

Example

TODO.

Now just take a unit test as an example:

#[tokio::test]
async fn test() {
  let h1 = tokio::spawn(ThreadFuture::from(|| {
    println!("1.1");
    yield_now();
    println!("1.2");
    1u32
  }));
  let h2 = tokio::spawn(ThreadFuture::from(|| {
    println!("2.1");
    yield_now();
    println!("2.2");
    2u32
  }));
  println!("join 1 => {}", h1.await.unwrap());
  println!("join 2 => {}", h2.await.unwrap());
}

Output:

1.1
2.1
1.2
2.2
join 1 => 1
join 2 => 2

Internal

stack-layout

Commit count: 15

cargo fmt