pub enum JsonCmp {
Eq(Value),
Ne(Value),
Gt(Value),
Lt(Value),
Ge(Value),
Le(Value),
In(Vec<Value>),
IsNull,
NotNull,
}Expand description
Represents comparison operations for JSON values.
Used with JsonFilter::Extract to compare extracted values against targets.
Variants§
Eq(Value)
Equal comparison.
Ne(Value)
Not equal comparison.
Gt(Value)
Greater than comparison.
Lt(Value)
Less than comparison.
Ge(Value)
Greater than or equal comparison.
Le(Value)
Less than or equal comparison.
In(Vec<Value>)
Check if value is in the provided list.
IsNull
Check if value is null or path doesn’t exist.
NotNull
Check if value is not null.
Implementations§
Source§impl JsonCmp
impl JsonCmp
Sourcepub fn matches(&self, value: Option<Value>) -> bool
pub fn matches(&self, value: Option<Value>) -> bool
Matches the given JSON value against the comparison operation.
In case the provided value is None, and the comparison is IsNull, it returns true.
Otherwise, it returns false for None values.
§Arguments
value- An optional JSON value to compare.
§Returns
true if the value matches the comparison operation, false otherwise.
Trait Implementations§
Source§impl CandidType for JsonCmp
impl CandidType for JsonCmp
Source§impl<'de> Deserialize<'de> for JsonCmp
impl<'de> Deserialize<'de> for JsonCmp
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
impl Eq for JsonCmp
impl StructuralPartialEq for JsonCmp
Auto Trait Implementations§
impl Freeze for JsonCmp
impl RefUnwindSafe for JsonCmp
impl Send for JsonCmp
impl Sync for JsonCmp
impl Unpin for JsonCmp
impl UnwindSafe for JsonCmp
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