Crates.io | dispatch-executor |
lib.rs | dispatch-executor |
version | 0.1.0 |
created_at | 2025-07-07 19:08:37.254652+00 |
updated_at | 2025-07-07 19:08:37.254652+00 |
description | An asynchronous executor for Apple's Grand Central Dispatch |
homepage | |
repository | https://github.com/alexmoon/corebluetooth-rs |
max_upload_size | |
id | 1741653 |
size | 16,560 |
An asynchronous executor for Apple's Grand Central Dispatch.
This crate provides an Executor
that can be used to spawn and run
asynchronous tasks on a GCD dispatch queue.
It also provides a Handle
type that allows for sending !Send
values
between threads, as long as they are only accessed on the thread that owns them.
use dispatch_executor::{Executor, MainThreadMarker};
async fn example() {
let mtm = MainThreadMarker::new().unwrap();
let executor = Executor::main_thread(mtm);
let task = executor.spawn(async {
println!("Hello, world!");
42
});
assert_eq!(task.await, 42);
}