pub enum ArgumentCondition {
Show 14 variants
ArgEquals {
index: usize,
value: Value,
},
ArgExists {
index: usize,
},
KwargEquals {
key: String,
value: Value,
},
KwargExists {
key: String,
},
KwargMatches {
key: String,
pattern: String,
},
ArgGreaterThan {
index: usize,
threshold: f64,
},
ArgLessThan {
index: usize,
threshold: f64,
},
KwargGreaterThan {
key: String,
threshold: f64,
},
KwargLessThan {
key: String,
threshold: f64,
},
KwargContains {
key: String,
value: Value,
},
And(Vec<ArgumentCondition>),
Or(Vec<ArgumentCondition>),
Not(Box<ArgumentCondition>),
Always,
}Expand description
Condition for matching task arguments
Allows routing based on the content of task arguments or keyword arguments.
Variants§
ArgEquals
Check if a positional argument at index equals a value
ArgExists
Check if a positional argument at index exists
KwargEquals
Check if a keyword argument equals a value
KwargExists
Check if a keyword argument exists
KwargMatches
Check if a keyword argument matches a pattern
ArgGreaterThan
Check if a positional argument is greater than a threshold
ArgLessThan
Check if a positional argument is less than a threshold
KwargGreaterThan
Check if a keyword argument is greater than a threshold
KwargLessThan
Check if a keyword argument is less than a threshold
KwargContains
Check if a keyword argument contains a value (for strings/arrays)
And(Vec<ArgumentCondition>)
Logical AND of multiple conditions
Or(Vec<ArgumentCondition>)
Logical OR of multiple conditions
Not(Box<ArgumentCondition>)
Logical NOT of a condition
Always
Always true (no argument condition)
Implementations§
Source§impl ArgumentCondition
impl ArgumentCondition
Sourcepub fn arg_equals(index: usize, value: Value) -> Self
pub fn arg_equals(index: usize, value: Value) -> Self
Create a condition that checks if arg[index] == value
Sourcepub fn arg_exists(index: usize) -> Self
pub fn arg_exists(index: usize) -> Self
Create a condition that checks if arg[index] exists
Sourcepub fn kwarg_equals(key: impl Into<String>, value: Value) -> Self
pub fn kwarg_equals(key: impl Into<String>, value: Value) -> Self
Create a condition that checks if kwargs[key] == value
Sourcepub fn kwarg_exists(key: impl Into<String>) -> Self
pub fn kwarg_exists(key: impl Into<String>) -> Self
Create a condition that checks if kwargs[key] exists
Sourcepub fn kwarg_matches(key: impl Into<String>, pattern: impl Into<String>) -> Self
pub fn kwarg_matches(key: impl Into<String>, pattern: impl Into<String>) -> Self
Create a condition that checks if kwargs[key] matches a regex pattern
Sourcepub fn arg_greater_than(index: usize, threshold: f64) -> Self
pub fn arg_greater_than(index: usize, threshold: f64) -> Self
Create a condition that checks if arg[index] > threshold
Sourcepub fn arg_less_than(index: usize, threshold: f64) -> Self
pub fn arg_less_than(index: usize, threshold: f64) -> Self
Create a condition that checks if arg[index] < threshold
Sourcepub fn kwarg_greater_than(key: impl Into<String>, threshold: f64) -> Self
pub fn kwarg_greater_than(key: impl Into<String>, threshold: f64) -> Self
Create a condition that checks if kwargs[key] > threshold
Sourcepub fn kwarg_less_than(key: impl Into<String>, threshold: f64) -> Self
pub fn kwarg_less_than(key: impl Into<String>, threshold: f64) -> Self
Create a condition that checks if kwargs[key] < threshold
Sourcepub fn kwarg_contains(key: impl Into<String>, value: Value) -> Self
pub fn kwarg_contains(key: impl Into<String>, value: Value) -> Self
Create a condition that checks if kwargs[key] contains value
Sourcepub fn and(self, other: ArgumentCondition) -> Self
pub fn and(self, other: ArgumentCondition) -> Self
Combine with AND
Sourcepub fn or(self, other: ArgumentCondition) -> Self
pub fn or(self, other: ArgumentCondition) -> Self
Combine with OR
Trait Implementations§
Source§impl Clone for ArgumentCondition
impl Clone for ArgumentCondition
Source§fn clone(&self) -> ArgumentCondition
fn clone(&self) -> ArgumentCondition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more