• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H03-May-2022-9779

src/H03-May-2022-591352

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D11-Jan-202174 65

.gitignoreH A D27-Aug-202019 32

CHANGELOG.mdH A D26-Dec-20201.3 KiB9650

Cargo.tomlH A D11-Jan-20212 KiB7966

Cargo.toml.orig-cargoH A D11-Jan-20211.3 KiB5749

LICENSE-APACHEH A D28-Aug-202010.6 KiB202169

LICENSE-MITH A D28-Aug-20201,023 2421

README.mdH A D26-Dec-20202.2 KiB5641

README.md

1# async-global-executor
2
3[![API Docs](https://docs.rs/async-global-executor/badge.svg)](https://docs.rs/async-global-executor)
4[![Build status](https://github.com/Keruspe/async-global-executor/workflows/Build%20and%20test/badge.svg)](https://github.com/Keruspe/async-global-executor/actions)
5[![Downloads](https://img.shields.io/crates/d/async-global-executor.svg)](https://crates.io/crates/async-global-executor)
6
7A global executor built on top of async-executor and async-io
8
9# Features
10
11* `async-io`: if enabled, `async-global-executor` will use `async_io::block_on` instead of
12  `futures_lite::future::block_on` internally. this is preferred if your application also uses `async-io`.
13* `blocking`: enable the use of the `blocking` crate through `async_global_executor::spawn_blocking`.
14* `tokio`: if enabled, `async-global-executor` will ensure that all tasks that you will spawn run in the context of a
15  tokio 1.0 runtime, spawning a new one if required.
16* `tokio03`: if enabled, `async-global-executor` will ensure that all tasks that you will spawn run in the context of a
17  tokio 0.3 runtime, spawning a new one if required.
18* `tokio02`: if enabled, `async-global-executor` will ensure that all tasks that you will spawn run in the context of a
19  tokio 0.2 runtime, spawning a new one if required.
20
21# Examples
22
23```
24# use futures_lite::future;
25
26// spawn a task on the multi-threaded executor
27let task1 = async_global_executor::spawn(async {
28    1 + 2
29});
30// spawn a task on the local executor (same thread)
31let task2 = async_global_executor::spawn_local(async {
32    3 + 4
33});
34let task = future::zip(task1, task2);
35
36// run the executor
37async_global_executor::block_on(async {
38    assert_eq!(task.await, (3, 7));
39});
40```
41
42## License
43
44Licensed under either of
45
46 * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
47 * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
48
49at your option.
50
51#### Contribution
52
53Unless you explicitly state otherwise, any contribution intentionally submitted
54for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
55dual licensed as above, without any additional terms or conditions.
56