Expand description
§Apple’s Dispatch (Grand Central Dispatch)
This crate provides a safe and sound interface to Apple’s Grand Central dispatch.
See Apple’s documentation and the source code for libdispatch for more details.
§Example
use dispatch2::{DispatchQueue, DispatchQueueAttr};
let queue = DispatchQueue::new("example_queue", DispatchQueueAttr::SERIAL);
queue.exec_async(|| println!("Hello"));
queue.exec_sync(|| println!("World"));
Structs§
- Dispatch
Auto Release Frequency - Values to pass to the dispatch_queue_attr_make_with_autorelease_frequency() function.
- Dispatch
Data - Dispatch data.
- Dispatch
Group - Dispatch group.
- Dispatch
Group Guard - Dispatch group guard.
- DispatchIO
- Dispatch IO.
- DispatchIO
Close Flags - DispatchIO
Interval Flags - DispatchIO
Stream Type - Dispatch
Once - A low-level synchronization primitive for one-time global execution.
- Dispatch
QoS - Quality-of-service classes that specify the priorities for executing tasks.
- Dispatch
Queue - Dispatch queue.
- Dispatch
Queue Attr - Dispatch queue attribute.
- Dispatch
Queue Global Priority - Queue priority.
- Dispatch
Retained - A reference counted pointer type for Dispatch objects.
- Dispatch
Semaphore - Dispatch semaphore.
- Dispatch
Semaphore Guard - Dispatch semaphore guard.
- Dispatch
Source - Dispatch source.
- Dispatch
Time - An abstract representation of time.
- Dispatch
Workloop - Dispatch workloop queue.
- Main
Thread Bound - Make a type that can only be used on the main thread be
Send
+Sync
. - dispatch_
source_ mach_ recv_ flags_ t - Mach receive-right flags.
- dispatch_
source_ mach_ send_ flags_ t - Mach send-right flags.
- dispatch_
source_ memorypressure_ flags_ t - dispatch_
source_ proc_ flags_ t - Events related to a process.
- dispatch_
source_ timer_ flags_ t - Flags to use when configuring a timer dispatch source.
- dispatch_
source_ type_ s - dispatch_
source_ vnode_ flags_ t - Events involving a change to a file system object.
Enums§
- Global
Queue Identifier - Global queue identifier definition for
DispatchQueue::new
andDispatchQueue::new_with_target
. - Quality
OfService Class Floor Error - Error returned by DispatchObject::set_qos_class_floor.
- Queue
After Error - Error returned by
DispatchQueue::after
. - Wait
Error - Wait error.
Constants§
Statics§
- _dispatch_
data_ ⚠destructor_ free - Apple’s documentation
- _dispatch_
data_ ⚠destructor_ munmap - Apple’s documentation
- _dispatch_
source_ ⚠type_ data_ add - Apple’s documentation
- _dispatch_
source_ ⚠type_ data_ or - Apple’s documentation
- _dispatch_
source_ ⚠type_ data_ replace - Apple’s documentation
- _dispatch_
source_ ⚠type_ mach_ recv - Apple’s documentation
- _dispatch_
source_ ⚠type_ mach_ send - Apple’s documentation
- _dispatch_
source_ ⚠type_ memorypressure - Apple’s documentation
- _dispatch_
source_ ⚠type_ proc - Apple’s documentation
- _dispatch_
source_ ⚠type_ read - Apple’s documentation
- _dispatch_
source_ ⚠type_ signal - Apple’s documentation
- _dispatch_
source_ ⚠type_ timer - Apple’s documentation
- _dispatch_
source_ ⚠type_ vnode - Apple’s documentation
- _dispatch_
source_ ⚠type_ write - Apple’s documentation
Traits§
- Dispatch
Object - Types that represent dispatch objects.
Functions§
- dispatch_
allow_ ⚠send_ signals - dispatch_
block_ ⚠cancel - Asynchronously cancel the specified dispatch block object.
- dispatch_
block_ ⚠create - Create a new dispatch block object on the heap from an existing block and the given flags.
- dispatch_
block_ ⚠create_ with_ qos_ class - Create a new dispatch block object on the heap from an existing block and the given flags, and assign it the specified QOS class and relative priority.
- dispatch_
block_ ⚠notify - Schedule a notification block to be submitted to a queue when the execution of a specified dispatch block object has completed.
- dispatch_
block_ ⚠perform - Create, synchronously execute and release a dispatch block object from the specified block and flags.
- dispatch_
block_ ⚠testcancel - Tests whether the given dispatch block object has been canceled.
- dispatch_
block_ ⚠wait - Wait synchronously until execution of the specified dispatch block object has completed or until the specified timeout has elapsed.
- dispatch_
get_ ⚠specific - Returns the current subsystem-specific context for a key unique to the subsystem.
- dispatch_
main - Executes blocks submitted to the main queue.
- dispatch_
read ⚠ - Schedule a read operation for asynchronous execution on the specified file descriptor. The specified handler is enqueued with the data read from the file descriptor when the operation has completed or an error occurs.
- dispatch_
write ⚠ - Schedule a write operation for asynchronous execution on the specified file descriptor. The specified handler is enqueued when the operation has completed or an error occurs.
- run_
on_ main - Submit the given closure to the runloop on the main thread.
Type Aliases§
- Group
Deprecated - Deprecated alias for
DispatchGroup
. - Once
Deprecated - Deprecated alias for
DispatchOnce
. - Queue
Deprecated - Deprecated alias for
DispatchQueue
. - Semaphore
Deprecated - Deprecated alias for
DispatchSemaphore
. - Workloop
Queue Deprecated - Deprecated alias for
DispatchWorkloop
. - dispatch_
block_ t - The type of blocks submitted to dispatch queues, which take no arguments and have no return value.
- dispatch_
data_ applier_ t - A block to be invoked for every contiguous memory region in a data object.
- dispatch_
fd_ t - Apple’s documentation
- dispatch_
function_ t - The prototype of functions submitted to dispatch queues.
- dispatch_
io_ handler_ t - The prototype of I/O handler blocks for dispatch I/O operations.
- dispatch_
once_ t - A predicate for use with dispatch_once(). It must be initialized to zero. Note: static and global variables default to zero.
- dispatch_
source_ type_ t