dispatch-executor

Crates.iodispatch-executor
lib.rsdispatch-executor
version0.1.0
created_at2025-07-07 19:08:37.254652+00
updated_at2025-07-07 19:08:37.254652+00
descriptionAn asynchronous executor for Apple's Grand Central Dispatch
homepage
repositoryhttps://github.com/alexmoon/corebluetooth-rs
max_upload_size
id1741653
size16,560
Alex Moon (alexmoon)

documentation

https://docs.rs/dispatch-executor

README

dispatch-executor

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.

Example

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);
}
Commit count: 0

cargo fmt