Struct tasque::TaskQueue
[−]
[src]
pub struct TaskQueue { /* fields omitted */ }
Task queue.
This queue spawns worker threads for executing registered tasks.
Examples
use tasque::TaskQueue; let queue = TaskQueue::new(); queue.enqueue(|| println!("Hello")); queue.enqueue(|| println!("World"));
Methods
impl TaskQueue
[src]
fn new() -> Self
[src]
Makes a new TaskQueue
instance.
This is equivalent to TaskQueueBuilder::new().finish()
.
fn enqueue<F>(&self, task: F) where
F: FnOnce() + Send + 'static,
[src]
F: FnOnce() + Send + 'static,
Enqueues a task.
The task will be executed by a worker thread.
If the thread panics while executing the task, it will be automatically restarted. Note that the task will not be retried in such case.
fn set_worker_count(&self, count: usize)
[src]
Updates the number of worker threads of this queue.
Trait Implementations
impl Debug for TaskQueue
[src]
impl Clone for TaskQueue
[src]
fn clone(&self) -> TaskQueue
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more