docs.rs failed to build executor-core-0.3.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
executor-core-0.2.1
executor-core
Write async libraries without choosing a runtime.
Your users should decide whether to use tokio, async-std, or any other runtime. Not you.
How It Works
Instead of hard-coding tokio::spawn
, accept an executor parameter:
use Executor;
pub async
Users call it with their runtime:
// tokio users
let runtime = new?;
let sum = parallel_sum.await;
// async-executor users
let executor = new;
let sum = parallel_sum.await;
Quick Start
Library authors:
[]
= "0.2"
App developers:
[]
= { = "0.2", = ["tokio"] }
API
Two traits:
Executor
- ForSend
futuresLocalExecutor
- For non-Send
futures
Both return async_task::Task
:
let task = executor.spawn;
let result = task.await; // Get result
task.cancel.await; // Cancel task
task.detach; // Run in background
Supported Runtimes
Runtime | Feature |
---|---|
tokio | "tokio" |
async-executor | "async-executor" |
Web/WASM | "web" |
License
MIT