pub struct TaskQueue { /* private fields */ }Expand description
Task queue with priority support.
Implementations§
Source§impl TaskQueue
impl TaskQueue
Sourcepub fn with_max_size(max_size: usize) -> Self
pub fn with_max_size(max_size: usize) -> Self
Create a new task queue with maximum size.
Sourcepub async fn try_dequeue(&self) -> Option<Task>
pub async fn try_dequeue(&self) -> Option<Task>
Try to dequeue without blocking.
Sourcepub fn get_running_task(&self, task_id: &TaskId) -> Option<Task>
pub fn get_running_task(&self, task_id: &TaskId) -> Option<Task>
Get running task by ID.
Sourcepub async fn pending_count(&self) -> usize
pub async fn pending_count(&self) -> usize
Get number of pending tasks.
Sourcepub fn running_count(&self) -> usize
pub fn running_count(&self) -> usize
Get number of running tasks.
Sourcepub async fn get_pending_tasks(&self) -> Vec<Task>
pub async fn get_pending_tasks(&self) -> Vec<Task>
Get all pending tasks (for inspection).
Sourcepub fn get_running_tasks(&self) -> Vec<Task>
pub fn get_running_tasks(&self) -> Vec<Task>
Get all running tasks (for inspection).
Sourcepub async fn remove(&self, task_id: TaskId) -> bool
pub async fn remove(&self, task_id: TaskId) -> bool
Remove a task from the queue (if not running).
Sourcepub async fn statistics(&self) -> QueueStatistics
pub async fn statistics(&self) -> QueueStatistics
Get queue statistics.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TaskQueue
impl !UnwindSafe for TaskQueue
impl Freeze for TaskQueue
impl Send for TaskQueue
impl Sync for TaskQueue
impl Unpin for TaskQueue
impl UnsafeUnpin for TaskQueue
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