refactor; add order() fn; add examples
This commit is contained in:
parent
d1419a2198
commit
6db5f79743
11 changed files with 388 additions and 11 deletions
17
examples/filter.rs
Normal file
17
examples/filter.rs
Normal 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");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue