pub struct TaskQueue<B: QueueBacking> { /* private fields */ }Expand description
Sends ordered tasks to a pool for background processing.
Implementations§
Source§impl<B: PushPopQueueBacking> TaskQueue<B>
impl<B: PushPopQueueBacking> TaskQueue<B>
Sourcepub fn join<T>(&self, task: impl TaskCollection<T>) -> T
pub fn join<T>(&self, task: impl TaskCollection<T>) -> T
Joins the pool in executing the given task. Both the current thread and the background
threads complete the task’s work. Semantically, this is equivalent to calling spawn(task).join(),
but is more efficient by ensuring that the present thread always receives at least one work item.
Sourcepub fn spawn<T>(&self, task: impl TaskCollection<T>) -> Task<T, B> ⓘ
pub fn spawn<T>(&self, task: impl TaskCollection<T>) -> Task<T, B> ⓘ
Spawns a new task into the queue.
Source§impl<P: Ord + Send + Sync> TaskQueue<Priority<P>>
impl<P: Ord + Send + Sync> TaskQueue<Priority<P>>
Sourcepub fn join<T>(&self, priority: P, task: impl TaskCollection<T>) -> T
pub fn join<T>(&self, priority: P, task: impl TaskCollection<T>) -> T
Joins the pool in executing the given task. Both the current thread and the background
threads complete the task’s work. Semantically, this is equivalent to calling spawn(task).join(),
but is more efficient by ensuring that the present thread always receives at least one work item.
Trait Implementations§
Source§impl<B: QueueBacking> WorkProvider for TaskQueue<B>
impl<B: QueueBacking> WorkProvider for TaskQueue<B>
Source§fn change_notifier(&self) -> &ChangeNotifier
fn change_notifier(&self) -> &ChangeNotifier
Gets a reference to the notifier which raises an event when new work is available.
Auto Trait Implementations§
impl<B> Freeze for TaskQueue<B>
impl<B> RefUnwindSafe for TaskQueue<B>
impl<B> Send for TaskQueue<B>
impl<B> Sync for TaskQueue<B>
impl<B> Unpin for TaskQueue<B>
impl<B> UnwindSafe for TaskQueue<B>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more