pub struct AsyncCompute { /* private fields */ }Expand description
Simulated async compute queue.
Implementations§
Source§impl AsyncCompute
impl AsyncCompute
Sourcepub fn submit(&mut self, task: &ComputeTask) -> usize
pub fn submit(&mut self, task: &ComputeTask) -> usize
Submit a task for async execution. Returns an index into the result list.
Sourcepub fn tick(&mut self)
pub fn tick(&mut self)
Advance all pending tasks by one simulated tick.
- Pending → Running
- Running → Done (with placeholder output)
Sourcepub fn poll(&self, idx: usize) -> Option<&AsyncResult>
pub fn poll(&self, idx: usize) -> Option<&AsyncResult>
Get the result for submission index idx.
Sourcepub fn drain_completed(&mut self) -> Vec<AsyncResult>
pub fn drain_completed(&mut self) -> Vec<AsyncResult>
Drain completed results.
Trait Implementations§
Source§impl Debug for AsyncCompute
impl Debug for AsyncCompute
Source§impl Default for AsyncCompute
impl Default for AsyncCompute
Source§fn default() -> AsyncCompute
fn default() -> AsyncCompute
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AsyncCompute
impl RefUnwindSafe for AsyncCompute
impl Send for AsyncCompute
impl Sync for AsyncCompute
impl Unpin for AsyncCompute
impl UnsafeUnpin for AsyncCompute
impl UnwindSafe for AsyncCompute
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more