20 releases (7 breaking)

✓ Uses Rust 2018 edition

new 0.7.0 Mar 25, 2020
0.6.0 Feb 3, 2020
0.5.3 Nov 15, 2019

#86 in No standard library

Download history 17/week @ 2019-12-02 158/week @ 2019-12-09 1/week @ 2019-12-16 18/week @ 2019-12-23 1/week @ 2019-12-30 23/week @ 2020-01-06 154/week @ 2020-01-13 53/week @ 2020-01-20 1/week @ 2020-01-27 20/week @ 2020-02-03 32/week @ 2020-02-10 141/week @ 2020-02-17 106/week @ 2020-02-24 3/week @ 2020-03-02 36/week @ 2020-03-09 24/week @ 2020-03-16

239 downloads per month
Used in watson

MIT/Apache

5KB
116 lines

executor

docs.rs docs

[dependencies]
executor = "0.6"

Features

  • #![no_std] + alloc
  • global executor for easy spawning
  • simple enough to learn from! (~ 100 lines)
  • simple macros for async entry functions

Example

A web assembly example

#[no_mangle]
#[executor::entry]
pub async fn main() {
    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?

use async_std::task::sleep;
use std::time::Duration;

#[executor::main]
async fn main() {
    println!("hello");
    sleep(Duration::from_secs(1)).await;
    println!("world!");
}

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.

Dependencies

~0.5–0.8MB
~19K SLoC