1 unstable release

0.1.0 Oct 1, 2022

#102 in macOS and iOS APIs

24 downloads per month

Apache-2.0 OR MIT

58KB
1K SLoC

dispatch2

Allows interaction with the Apple Dispatch library in a safe and unsafe way.

Usage

To use dispatch2, add this to your Cargo.toml:

[dependencies]
dispatch2 = "0.1.0"

Example

use dispatch2::{Queue, QueueAttribute};

fn main() {
    let queue = Queue::new("example_queue", QueueAttribute::Serial);
    queue.exec_async(|| println!("Hello"));
    queue.exec_sync(|| println!("World"));
}

License

dispatch2 is distributed under the terms of either the MIT license or the Apache License (Version 2.0), at the user's choice.

See LICENSE-APACHE and LICENSE-MIT.


lib.rs:

Apple Dispatch (Grand Central Dispatch)

This crate allows interaction with the Apple Dispatch library in a safe (dispatch2 module) and unsafe (ffi module) way.

Example:

use dispatch2::{Queue, QueueAttribute};

fn main() {
    let queue = Queue::new("example_queue", QueueAttribute::Serial);
    queue.exec_async(|| println!("Hello"));
    queue.exec_sync(|| println!("World"));
}

Dependencies