pub struct ConditionalTask {
pub name: String,
pub description: String,
pub condition: Box<dyn Fn(&str) -> bool + Send + Sync>,
}Expand description
Wraps a task description with a condition that is evaluated against the previous task’s output. If the condition returns false, the task is skipped entirely.
Fields§
§name: String§description: String§condition: Box<dyn Fn(&str) -> bool + Send + Sync>Implementations§
Source§impl ConditionalTask
impl ConditionalTask
Sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
condition: impl Fn(&str) -> bool + Send + Sync + 'static,
) -> Self
pub fn new( name: impl Into<String>, description: impl Into<String>, condition: impl Fn(&str) -> bool + Send + Sync + 'static, ) -> Self
Create a new conditional task that only executes when condition returns true
on the previous task’s output.
Sourcepub fn should_execute(&self, previous_output: &str) -> bool
pub fn should_execute(&self, previous_output: &str) -> bool
Returns true if this task should be executed given previous_output.
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