#[non_exhaustive]pub enum ValueComparison {
IFEQ(String),
IFNE(String),
IFDEQ(String),
IFDNE(String),
}Expand description
Helper enum that is used to define comparisons between values and their digests
§Example
use redis::ValueComparison;
// Create comparisons using constructor methods
let eq_comparison = ValueComparison::ifeq("my_value");
let ne_comparison = ValueComparison::ifne("other_value");
let deq_comparison = ValueComparison::ifdeq("digest_hash");
let dne_comparison = ValueComparison::ifdne("other_digest");Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
IFEQ(String)
Value is equal
IFNE(String)
Value is not equal
IFDEQ(String)
Value’s digest is equal
IFDNE(String)
Value’s digest is not equal
Implementations§
Source§impl ValueComparison
impl ValueComparison
Sourcepub fn ifeq(value: impl ToSingleRedisArg) -> Self
pub fn ifeq(value: impl ToSingleRedisArg) -> Self
Create a new IFEQ (if equal) comparison
Performs the operation only if the key’s current value is equal to the provided value.
For SET: Sets the key only if its current value matches. Non-existent keys are not created. For DEL_EX: Deletes the key only if its current value matches. Non-existent keys are ignored.
Sourcepub fn ifne(value: impl ToSingleRedisArg) -> Self
pub fn ifne(value: impl ToSingleRedisArg) -> Self
Create a new IFNE (if not equal) comparison
Performs the operation only if the key’s current value is not equal to the provided value.
For SET: Sets the key only if its current value doesn’t match. Non-existent keys are created. For DEL_EX: Deletes the key only if its current value doesn’t match. Non-existent keys are ignored.
Sourcepub fn ifdeq(digest: impl ToSingleRedisArg) -> Self
pub fn ifdeq(digest: impl ToSingleRedisArg) -> Self
Create a new IFDEQ (if digest equal) comparison
Performs the operation only if the digest of the key’s current value is equal to the provided digest.
For SET: Sets the key only if its current value’s digest matches. Non-existent keys are not created. For DEL_EX: Deletes the key only if its current value’s digest matches. Non-existent keys are ignored.
Use calculate_value_digest to compute the digest of a value.
Sourcepub fn ifdne(digest: impl ToSingleRedisArg) -> Self
pub fn ifdne(digest: impl ToSingleRedisArg) -> Self
Create a new IFDNE (if digest not equal) comparison
Performs the operation only if the digest of the key’s current value is not equal to the provided digest.
For SET: Sets the key only if its current value’s digest doesn’t match. Non-existent keys are created. For DEL_EX: Deletes the key only if its current value’s digest doesn’t match. Non-existent keys are ignored.
Use calculate_value_digest to compute the digest of a value.
Trait Implementations§
Source§impl Clone for ValueComparison
impl Clone for ValueComparison
Source§fn clone(&self) -> ValueComparison
fn clone(&self) -> ValueComparison
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValueComparison
impl Debug for ValueComparison
Source§impl ToRedisArgs for ValueComparison
impl ToRedisArgs for ValueComparison
Source§fn write_redis_args<W>(&self, out: &mut W)where
W: ?Sized + RedisWrite,
fn write_redis_args<W>(&self, out: &mut W)where
W: ?Sized + RedisWrite,
Source§fn to_redis_args(&self) -> Vec<Vec<u8>>
fn to_redis_args(&self) -> Vec<Vec<u8>>
Source§fn describe_numeric_behavior(&self) -> NumericBehavior
fn describe_numeric_behavior(&self) -> NumericBehavior
INCR vs INCRBYFLOAT).Source§fn num_of_args(&self) -> usize
fn num_of_args(&self) -> usize
Auto Trait Implementations§
impl Freeze for ValueComparison
impl RefUnwindSafe for ValueComparison
impl Send for ValueComparison
impl Sync for ValueComparison
impl Unpin for ValueComparison
impl UnwindSafe for ValueComparison
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> 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