Go to file
Stjepan Glavina e41f34cc00 Initial commit 2020-07-23 12:08:20 +02:00
.github Initial commit 2020-07-23 12:08:20 +02:00
src Initial commit 2020-07-23 12:08:20 +02:00
.gitignore Initial commit 2020-07-23 12:08:20 +02:00
CHANGELOG.md Initial commit 2020-07-23 12:08:20 +02:00
Cargo.toml Initial commit 2020-07-23 12:08:20 +02:00
LICENSE-APACHE Initial commit 2020-07-23 12:08:20 +02:00
LICENSE-MIT Initial commit 2020-07-23 12:08:20 +02:00
README.md Initial commit 2020-07-23 12:08:20 +02:00
rustfmt.toml Initial commit 2020-07-23 12:08:20 +02:00

README.md

async-executor

Build License Cargo Documentation

Async executor.

This crate offers two kinds of executors: single-threaded and multi-threaded.

Examples

Run a single-threaded and a multi-threaded executor at the same time:

use async_channel::unbounded;
use async_executor::{Executor, LocalExecutor};
use easy_parallel::Parallel;

let ex = Executor::new();
let local_ex = LocalExecutor::new();
let (trigger, shutdown) = unbounded::<()>();

Parallel::new()
    // Run four executor threads.
    .each(0..4, |_| ex.run(shutdown.recv()))
    // Run local executor on the current thread.
    .finish(|| local_ex.run(async {
        println!("Hello world!");
        drop(trigger);
    }));

License

Licensed under either of

at your option.

Contribution

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