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.
async-dispatch
Async task dispatch via Grand Central Dispatch (GCD) for Apple platforms.
Instead of managing your own async runtime (like tokio), this crate hands off task scheduling to the operating system's native dispatch queues. You spawn futures; GCD handles the rest.
Documentation
API docs are hosted on GitHub Pages. Since this crate only builds on Apple platforms, docs.rs cannot generate documentation for it.
Usage
use ;
use Duration;
// Spawn on a background queue
let task = spawn;
// Spawn on the main thread (for UI work)
spawn_on_main.detach;
// Spawn after a delay
let task = spawn_after;
// Await the result or detach to run in background
let result = task.await;
// Sleep within an async context
spawn.detach;
Task lifecycle
task.await- wait for completion and get the resulttask.detach()- let it run to completion, discard the result- dropping a task cancels it
Requirements
- macOS or iOS (uses libdispatch)
- Rust 2021 edition
How it works
The crate uses async-task to convert Rust futures into raw function pointers that can be passed to GCD's dispatch_async_f. When GCD executes the function, it polls the future. If the future yields, subsequent wakeups are dispatched back to GCD.
There is no runtime to start or stop. GCD manages thread pools and scheduling.
Limitations
- Apple platforms only (macOS, iOS, etc.)
- No priority control yet (uses default queue priority)
- No
block_onfor synchronously waiting on futures. (usefutures::block_on)
Attribution
This approach is based on the dispatcher implementation in Zed's gpui crate, which uses GCD for async task scheduling on macOS. The gpui crate is licensed under Apache-2.0.