pub enum ChainCondition {
UrlContains(String),
UrlMatches(String),
PageContains(String),
ElementExists(String),
PreviousSucceeded,
PreviousFailed,
Always,
Never,
All(Vec<ChainCondition>),
Any(Vec<ChainCondition>),
Not(Box<ChainCondition>),
}Expand description
Condition for conditional execution in action chains.
Variants§
UrlContains(String)
Execute if URL contains this string.
UrlMatches(String)
Execute if URL matches this pattern (regex-like).
PageContains(String)
Execute if page contains this text.
ElementExists(String)
Execute if an element matching this selector exists.
PreviousSucceeded
Execute if previous step succeeded.
PreviousFailed
Execute if previous step failed.
Always
Always execute (default).
Never
Never execute (skip).
All(Vec<ChainCondition>)
All conditions must be true.
Any(Vec<ChainCondition>)
Any condition must be true.
Not(Box<ChainCondition>)
Invert the condition.
Implementations§
Source§impl ChainCondition
impl ChainCondition
Sourcepub fn url_contains(pattern: impl Into<String>) -> Self
pub fn url_contains(pattern: impl Into<String>) -> Self
Create a URL contains condition.
Sourcepub fn element_exists(selector: impl Into<String>) -> Self
pub fn element_exists(selector: impl Into<String>) -> Self
Create an element exists condition.
Sourcepub fn page_contains(text: impl Into<String>) -> Self
pub fn page_contains(text: impl Into<String>) -> Self
Create a page contains condition.
Sourcepub fn and(self, other: ChainCondition) -> Self
pub fn and(self, other: ChainCondition) -> Self
Combine with AND.
Sourcepub fn or(self, other: ChainCondition) -> Self
pub fn or(self, other: ChainCondition) -> Self
Combine with OR.
Sourcepub fn evaluate(&self, ctx: &ChainContext) -> bool
pub fn evaluate(&self, ctx: &ChainContext) -> bool
Evaluate this condition against the context.
Trait Implementations§
Source§impl Clone for ChainCondition
impl Clone for ChainCondition
Source§fn clone(&self) -> ChainCondition
fn clone(&self) -> ChainCondition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ChainCondition
impl Debug for ChainCondition
Source§impl Default for ChainCondition
impl Default for ChainCondition
Source§fn default() -> ChainCondition
fn default() -> ChainCondition
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ChainCondition
impl<'de> Deserialize<'de> for ChainCondition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Not for ChainCondition
impl Not for ChainCondition
Auto Trait Implementations§
impl Freeze for ChainCondition
impl RefUnwindSafe for ChainCondition
impl Send for ChainCondition
impl Sync for ChainCondition
impl Unpin for ChainCondition
impl UnwindSafe for ChainCondition
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