[−][src]Struct dispatch::Queue
A Grand Central Dispatch queue.
For more information, see Apple's Grand Central Dispatch reference.
Methods
impl Queue
[src]
pub fn main() -> Self
[src]
Returns the serial dispatch Queue
associated with the application's
main thread.
pub fn global(priority: QueuePriority) -> Self
[src]
Returns a system-defined global concurrent Queue
with the specified
priority.
pub fn create(label: &str, attr: QueueAttribute) -> Self
[src]
Creates a new dispatch Queue
.
pub fn with_target_queue(
label: &str,
attr: QueueAttribute,
target: &Queue
) -> Self
[src]
label: &str,
attr: QueueAttribute,
target: &Queue
) -> Self
Creates a new dispatch Queue
with the given target queue.
A dispatch queue's priority is inherited from its target queue. Additionally, if both the queue and its target are serial queues, their blocks will not be invoked concurrently.
pub fn label(&self) -> &str
[src]
Returns the label that was specified for self.
pub fn sync<T, F>(&self, work: F) -> T where
F: Send + FnOnce() -> T,
T: Send,
[src]
F: Send + FnOnce() -> T,
T: Send,
Submits a closure for execution on self and waits until it completes.
pub fn async<F>(&self, work: F) where
F: 'static + Send + FnOnce(),
[src]
F: 'static + Send + FnOnce(),
Submits a closure for asynchronous execution on self and returns immediately.
pub fn after_ms<F>(&self, ms: u32, work: F) where
F: 'static + Send + FnOnce(),
[src]
F: 'static + Send + FnOnce(),
After the specified delay, submits a closure for asynchronous execution on self.
pub fn after<F>(&self, delay: Duration, work: F) where
F: 'static + Send + FnOnce(),
[src]
F: 'static + Send + FnOnce(),
After the specified delay, submits a closure for asynchronous execution on self.
pub fn apply<F>(&self, iterations: usize, work: F) where
F: Sync + Fn(usize),
[src]
F: Sync + Fn(usize),
Submits a closure to be executed on self the given number of iterations and waits until it completes.
pub fn foreach<T, F>(&self, slice: &mut [T], work: F) where
F: Sync + Fn(&mut T),
T: Send,
[src]
F: Sync + Fn(&mut T),
T: Send,
Submits a closure to be executed on self for each element of the provided slice and waits until it completes.
pub fn map<T, U, F>(&self, vec: Vec<T>, work: F) -> Vec<U> where
F: Sync + Fn(T) -> U,
T: Send,
U: Send,
[src]
F: Sync + Fn(T) -> U,
T: Send,
U: Send,
Submits a closure to be executed on self for each element of the
provided vector and returns a Vec
of the mapped elements.
pub fn barrier_sync<T, F>(&self, work: F) -> T where
F: Send + FnOnce() -> T,
T: Send,
[src]
F: Send + FnOnce() -> T,
T: Send,
Submits a closure to be executed on self as a barrier and waits until it completes.
Barriers create synchronization points within a concurrent queue. If self is concurrent, when it encounters a barrier it delays execution of the closure (and any further ones) until all closures submitted before the barrier finish executing. At that point, the barrier closure executes by itself. Upon completion, self resumes its normal execution behavior.
If self is a serial queue or one of the global concurrent queues,
this method behaves like the normal sync
method.
pub fn barrier_async<F>(&self, work: F) where
F: 'static + Send + FnOnce(),
[src]
F: 'static + Send + FnOnce(),
Submits a closure to be executed on self as a barrier and returns immediately.
Barriers create synchronization points within a concurrent queue. If self is concurrent, when it encounters a barrier it delays execution of the closure (and any further ones) until all closures submitted before the barrier finish executing. At that point, the barrier closure executes by itself. Upon completion, self resumes its normal execution behavior.
If self is a serial queue or one of the global concurrent queues,
this method behaves like the normal async
method.
pub fn suspend(&self) -> SuspendGuard
[src]
Suspends the invocation of blocks on self and returns a SuspendGuard
that can be dropped to resume.
The suspension occurs after completion of any blocks running at the
time of the call.
Invocation does not resume until all SuspendGuard
s have been dropped.
Trait Implementations
impl Sync for Queue
[src]
impl Clone for Queue
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Drop for Queue
[src]
impl Send for Queue
[src]
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,