-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…#68) * remove JsonPathInst, instead move `find` functionality to `JsonPath`. no longer export all macros, add comments to the remaining ones. Implement `FromStr` and `TryFrom<&str` for JsonPath (as the internet is not sure which is better) fix various clippy things. * keep export for macros
- Loading branch information
Showing
12 changed files
with
1,065 additions
and
1,010 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
use jsonpath_rust::JsonPathInst; | ||
use jsonpath_rust::JsonPath; | ||
use serde_json::json; | ||
use std::str::FromStr; | ||
|
||
fn main() { | ||
let data = json!({ | ||
"Hello":"World", | ||
"Good":"Bye", | ||
}); | ||
let path = JsonPathInst::from_str("$.Hello").unwrap(); | ||
let search_result = jsonpath_rust::find(&path, &data); | ||
let path = JsonPath::try_from("$.Hello").unwrap(); | ||
let search_result = path.find(&data); | ||
println!("Hello, {}", search_result); | ||
} |
Oops, something went wrong.