Skip to content
An async/await executor for Rust πŸ’€
Rust Makefile
Branch: master
Clone or download
Latest commit 60a5d3a Nov 12, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples adding simpler interface Nov 11, 2019
src Update lib.rs Nov 13, 2019
.gitignore first commit Oct 8, 2019
Cargo.lock simpler Nov 13, 2019
Cargo.toml simpler Nov 13, 2019
LICENSE-APACHE mit or apache Oct 8, 2019
LICENSE-MIT mit or apache Oct 8, 2019
Makefile first commit Oct 8, 2019
README.md Update README.md Nov 13, 2019

README.md

πŸ’€ executor

docs.rs docs

[dependencies]
executor = "0.2"

Features

  • #![no_std] and minimally uses alloc (Box and Arc)
  • handle more than one spawn to parallelize work
  • simple enough to learn from! (< 100 lines)

Example

A web assembly example

[no_mangle]
pub fn main() -> () {
    executor::spawn(async {
        console_log("Hello");
        set_timeout(1000).await;
        console_log("World!");
    });
}

fn set_timeout(milliseconds:u32) -> TimeoutFuture {
   // create a timeout future and store globally
}

[no_mangle]
pub fn timeout_complete() -> () {
    // find your timeout future and wake it's waker
}

async-std

Want to use async-std?

async fn run() {
    println!("hello");
    async_std::task::sleep(std::time::Duration::from_secs(1)).await;
    println!("world!");
    complete::mark_complete();
}

fn main() -> () {
    std::thread::spawn(move || {
        executor::spawn(run());
    });
    complete::block_until_complete();
}

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in executor by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

You can’t perform that action at this time.