pub struct JsonPathEvaluator { /* private fields */ }Expand description
JSONPath evaluator for condition matching Supports: exists, ==, !=, in, &&, ||, >, <, >=, <=, regex
Implementations§
Source§impl JsonPathEvaluator
impl JsonPathEvaluator
pub fn new(expression: &str) -> Result<Self, String>
Sourcepub fn matches(&self, value: &Value) -> bool
pub fn matches(&self, value: &Value) -> bool
Check if expression matches the JSON value
Supports:
- exists($.path) - check if path exists
- $.path == “value” - equality check
- $.path != “value” - inequality check
- $.path in [‘value1’, ‘value2’] - list membership
- $.path != null / $.path == null - null check
- $.path > 10 / $.path < 10 - numeric comparison
- $.path >= 10 / $.path <= 10 - numeric comparison
- $.path =~ /pattern/ - regex matching
- && and || for logical combination
Sourcepub fn extract_string(&self, value: &Value) -> Option<String>
pub fn extract_string(&self, value: &Value) -> Option<String>
Extract string value from JSON using path
Trait Implementations§
Source§impl Clone for JsonPathEvaluator
impl Clone for JsonPathEvaluator
Source§fn clone(&self) -> JsonPathEvaluator
fn clone(&self) -> JsonPathEvaluator
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 moreAuto Trait Implementations§
impl Freeze for JsonPathEvaluator
impl RefUnwindSafe for JsonPathEvaluator
impl Send for JsonPathEvaluator
impl Sync for JsonPathEvaluator
impl Unpin for JsonPathEvaluator
impl UnwindSafe for JsonPathEvaluator
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