refactor; add order() fn; add examples
This commit is contained in:
parent
d1419a2198
commit
6db5f79743
11 changed files with 388 additions and 11 deletions
16
examples/comparison.rs
Normal file
16
examples/comparison.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
use jsonfilter::order;
|
||||
use serde_json::json;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
fn main() {
|
||||
let a = json!(10);
|
||||
let b = json!(5);
|
||||
println!("Comparing JSON values:");
|
||||
println!("a: {}", a);
|
||||
println!("b: {}", b);
|
||||
match order(&a, &b) {
|
||||
Ordering::Greater => println!("a is greater than b"),
|
||||
Ordering::Less => println!("a is less than b"),
|
||||
Ordering::Equal => println!("a is equal to b"),
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue