pub enum CounterComparator {
Eq(i64),
Lt(i64),
Gt(i64),
Ne(i64),
Nil,
}Expand description
Comparison operator used by conditional counter writes.
The comparator is evaluated against the current observed counter value.
§Examples
use distkit::CounterComparator;
assert!(CounterComparator::Eq(5).matches(5));
assert!(CounterComparator::Lt(5).matches(4));
assert!(CounterComparator::Gt(5).matches(6));
assert!(CounterComparator::Ne(5).matches(4));
assert!(CounterComparator::Nil.matches(42));Variants§
Eq(i64)
Matches when the current value is equal to the embedded operand.
Lt(i64)
Matches when the current value is less than the embedded operand.
Gt(i64)
Matches when the current value is greater than the embedded operand.
Ne(i64)
Matches when the current value is not equal to the embedded operand.
Nil
Always matches.
This is primarily useful for delegating unconditional APIs through the conditional write path, or for mixing guarded and unguarded writes in a single batch call.
Implementations§
Trait Implementations§
Source§impl Clone for CounterComparator
impl Clone for CounterComparator
Source§fn clone(&self) -> CounterComparator
fn clone(&self) -> CounterComparator
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 CounterComparator
impl Debug for CounterComparator
Source§impl PartialEq for CounterComparator
impl PartialEq for CounterComparator
impl Copy for CounterComparator
impl Eq for CounterComparator
impl StructuralPartialEq for CounterComparator
Auto Trait Implementations§
impl Freeze for CounterComparator
impl RefUnwindSafe for CounterComparator
impl Send for CounterComparator
impl Sync for CounterComparator
impl Unpin for CounterComparator
impl UnsafeUnpin for CounterComparator
impl UnwindSafe for CounterComparator
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