Trait vector::conditions::Conditional
source · pub trait Conditional: Debug {
// Required method
fn check(&self, event: Event) -> (bool, Event);
// Provided method
fn check_with_context(&self, e: Event) -> (Result<(), String>, Event) { ... }
}
Required Methods§
Provided Methods§
sourcefn check_with_context(&self, e: Event) -> (Result<(), String>, Event)
fn check_with_context(&self, e: Event) -> (Result<(), String>, Event)
Checks if a condition is true, with a Result
-oriented return for easier composition.
This can be mildly expensive for conditions that do not often match, as it allocates a string for the error case. As such, it should typically be avoided in hot paths.