pub enum Condition {
Show 13 variants
True,
False,
Not(Box<Condition>),
And(Box<Condition>, Box<Condition>),
Or(Box<Condition>, Box<Condition>),
ConnectionSeqNo(usize),
RequestOpcode(RequestOpcode),
ResponseOpcode(ResponseOpcode),
BodyContainsCaseSensitive(Box<[u8]>),
BodyContainsCaseInsensitive(Box<[u8]>),
RandomWithProbability(f64),
TrueForLimitedTimes(usize),
ConnectionRegisteredAnyEvent,
}Expand description
Specifies when an associated Reaction will be performed.
Conditions are subject to logic, with not(), and() and or()
convenience functions.
Variants§
True
False
Not(Box<Condition>)
And(Box<Condition>, Box<Condition>)
Or(Box<Condition>, Box<Condition>)
ConnectionSeqNo(usize)
True iff the frame has come in the n-th driver connection established with the driver.
RequestOpcode(RequestOpcode)
True iff the frame has the given opcode (and is a request).
ResponseOpcode(ResponseOpcode)
True iff the frame has the given opcode (and is a response).
BodyContainsCaseSensitive(Box<[u8]>)
True iff the frame body contains the given byte slice, with case-sensitive comparison.
BodyContainsCaseInsensitive(Box<[u8]>)
True iff the frame body contains the given byte slice, with case-insensitive comparison (ASCII only).
RandomWithProbability(f64)
True with the given probability.
TrueForLimitedTimes(usize)
True for predefined number of evaluations, then always false.
ConnectionRegisteredAnyEvent
True if any REGISTER was sent on this connection. Useful to filter out control connection messages.
Implementations§
Source§impl Condition
impl Condition
Sourcepub fn not(c: Self) -> Self
pub fn not(c: Self) -> Self
A convenience function for creating Condition::Not variant.
Sourcepub fn and(self, c2: Self) -> Self
pub fn and(self, c2: Self) -> Self
A convenience function for creating Condition::And variant.
Sourcepub fn or(self, c2: Self) -> Self
pub fn or(self, c2: Self) -> Self
A convenience function for creating Condition::Or variant.
Sourcepub fn all(cs: impl IntoIterator<Item = Self>) -> Self
pub fn all(cs: impl IntoIterator<Item = Self>) -> Self
A convenience function for creating a tree with Condition::And variant in nodes.
Sourcepub fn any(cs: impl IntoIterator<Item = Self>) -> Self
pub fn any(cs: impl IntoIterator<Item = Self>) -> Self
A convenience function for creating a tree with Condition::Or variant in nodes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Condition
impl RefUnwindSafe for Condition
impl Send for Condition
impl Sync for Condition
impl Unpin for Condition
impl UnsafeUnpin for Condition
impl UnwindSafe for Condition
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more