pub struct Filter { /* private fields */ }Expand description
A parsed filter expression.
The mini-DSL supports a conjunction of comparisons joined by and:
filter := clause ( " and " clause )*
clause := field op literal
op := "==" | "!=" | "<=" | ">=" | "<" | ">"
literal := number | 'string' | "string" | true | false | null | bareword§Examples
use sheeter_engine::Filter;
use sheeter_engine::CanonicalValue;
let f = Filter::parse("age > 30 and name == 'Bob'").unwrap();
let row = CanonicalValue::Object(vec![
("age".to_string(), CanonicalValue::Number(serde_json::Number::from(40))),
("name".to_string(), CanonicalValue::String("Bob".to_string())),
]);
assert!(f.matches(&row));Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Filter
impl RefUnwindSafe for Filter
impl Send for Filter
impl Sync for Filter
impl Unpin for Filter
impl UnsafeUnpin for Filter
impl UnwindSafe for Filter
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