https://github.com/wangrunji0408/greenthread-future-rs
Rust: Convert closures into futures based on greenthread on bare-metal (no_std + no_alloc).
https://github.com/wangrunji0408/greenthread-future-rs
async bare-metal future rust
Last synced: about 1 year ago
JSON representation
Rust: Convert closures into futures based on greenthread on bare-metal (no_std + no_alloc).
- Host: GitHub
- URL: https://github.com/wangrunji0408/greenthread-future-rs
- Owner: wangrunji0408
- License: mit
- Created: 2020-02-01T17:27:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-07T09:49:34.000Z (about 6 years ago)
- Last Synced: 2025-04-10T12:29:37.679Z (about 1 year ago)
- Topics: async, bare-metal, future, rust
- Language: Rust
- Homepage:
- Size: 18.6 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# greenthread-future-rs
[](https://crates.io/crates/greenthread-future)
[](https://docs.rs/greenthread-future)
[](https://github.com/wangrunji0408/greenthread-future-rs/actions)
[](https://coveralls.io/github/wangrunji0408/greenthread-future-rs?branch=master)
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](https://github.com/robertohuertasm/futurify).
I'm exploring to use it to implement bare-metal threading.
## Example
TODO.
Now just take a unit test as an example:
```rust
#[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
