[−][src]Struct tasque::TaskQueue
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]
pub fn new() -> Self
[src]
Makes a new TaskQueue
instance.
This is equivalent to TaskQueueBuilder::new().finish()
.
pub 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.
pub fn set_worker_count(&self, count: usize)
[src]
Updates the number of worker threads of this queue.
pub fn worker_count(&self) -> usize
[src]
Returns the number of worker threads of this queue.
pub fn len(&self) -> usize
[src]
Returns the number of tasks (enqueued but not yet dequeued) in this queue.
Trait Implementations
impl Default for TaskQueue
[src]
impl Clone for TaskQueue
[src]
fn clone(&self) -> TaskQueue
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for TaskQueue
[src]
Auto Trait Implementations
impl Unpin for TaskQueue
impl Send for TaskQueue
impl !Sync for TaskQueue
impl !RefUnwindSafe for TaskQueue
impl !UnwindSafe for TaskQueue
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> 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, U> TryInto<U> 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> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,