pub struct AsyncTaskQueue { /* private fields */ }Expand description
An asynchronous task queue.
Simulates a queue of pending async IO tasks identified by integer handles.
Implementations§
Source§impl AsyncTaskQueue
impl AsyncTaskQueue
Sourcepub fn enqueue(&mut self, description: impl Into<String>) -> usize
pub fn enqueue(&mut self, description: impl Into<String>) -> usize
Enqueue a new task, returning its handle.
Sourcepub fn complete_next(&mut self, result: impl Into<String>) -> Option<usize>
pub fn complete_next(&mut self, result: impl Into<String>) -> Option<usize>
Complete the next pending task with the given result.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Number of pending tasks.
Sourcepub fn completed_count(&self) -> usize
pub fn completed_count(&self) -> usize
Number of completed tasks.
Sourcepub fn is_complete(&self, id: usize) -> bool
pub fn is_complete(&self, id: usize) -> bool
Check if a task has completed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AsyncTaskQueue
impl RefUnwindSafe for AsyncTaskQueue
impl Send for AsyncTaskQueue
impl Sync for AsyncTaskQueue
impl Unpin for AsyncTaskQueue
impl UnsafeUnpin for AsyncTaskQueue
impl UnwindSafe for AsyncTaskQueue
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