pub struct LoopTask { /* private fields */ }Expand description
A task that runs body repeatedly until break_when returns true or the
iteration count reaches max_iterations.
The body receives the zero-based iteration index. The task output is
{"iterations": <n>, "last": <last body output>, "broke_early": <bool>}.
Cancellation is honored between iterations.
Implementations§
Source§impl LoopTask
impl LoopTask
Sourcepub fn new<F, Fut>(id: impl Into<String>, max_iterations: u32, body: F) -> Self
pub fn new<F, Fut>(id: impl Into<String>, max_iterations: u32, body: F) -> Self
Create a loop task.
Sourcepub fn with_break<F>(self, break_when: F) -> Self
pub fn with_break<F>(self, break_when: F) -> Self
Set the early-exit predicate, evaluated against each body output.
Sourcepub fn with_priority(self, priority: u8) -> Self
pub fn with_priority(self, priority: u8) -> Self
Set scheduling priority.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for LoopTask
impl !UnwindSafe for LoopTask
impl Freeze for LoopTask
impl Send for LoopTask
impl Sync for LoopTask
impl Unpin for LoopTask
impl UnsafeUnpin for LoopTask
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