pub struct ConditionalTask { /* private fields */ }Expand description
A branching task.
It evaluates an async predicate and records the chosen branch label on the
context blackboard under the key {id}.branch. Downstream tasks can read
that value to decide whether to do real work or short-circuit, implementing
conditional control flow within an otherwise static DAG.
The task’s own output is {"taken": <bool>, "branch": <label>}.
Implementations§
Source§impl ConditionalTask
impl ConditionalTask
Sourcepub fn new<F, Fut>(
id: impl Into<String>,
on_true: impl Into<String>,
on_false: impl Into<String>,
predicate: F,
) -> Self
pub fn new<F, Fut>( id: impl Into<String>, on_true: impl Into<String>, on_false: impl Into<String>, predicate: F, ) -> Self
Create a conditional with the given async predicate.
on_true/on_false are the branch labels published to the blackboard.
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 ConditionalTask
impl !UnwindSafe for ConditionalTask
impl Freeze for ConditionalTask
impl Send for ConditionalTask
impl Sync for ConditionalTask
impl Unpin for ConditionalTask
impl UnsafeUnpin for ConditionalTask
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