refactor; add order() fn; add examples

This commit is contained in:
JMARyA 2024-02-09 14:34:12 +01:00
parent d1419a2198
commit 6db5f79743
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
11 changed files with 388 additions and 11 deletions

17
examples/filter.rs Normal file
View file

@ -0,0 +1,17 @@
use jsonfilter::matches;
use serde_json::json;
fn main() {
let filter = json!({"name": "John", "age": 30});
let obj = json!({"name": "John", "age": 30, "city": "New York"});
println!("Applying filter:");
println!("{}", filter);
println!("To object:");
println!("{}", obj);
if matches(&filter, &obj) {
println!("Filter matches the object");
} else {
println!("Filter does not match the object");
}
}