Struct jsonpath_lib::Compiled [−][src]
pub struct Compiled { /* fields omitted */ }
Expand description
A pre-compiled expression.
Calling the select function of this struct will re-use the existing, compiled expression.
Example
extern crate jsonpath_lib as jsonpath; #[macro_use] extern crate serde_json; let mut first_friend = jsonpath::Compiled::compile("$..friends[0]").unwrap(); let json_obj = json!({ "school": { "friends": [ {"name": "친구1", "age": 20}, {"name": "친구2", "age": 20} ] }, "friends": [ {"name": "친구3", "age": 30}, {"name": "친구4"} ]}); // call a first time let json = first_friend.select(&json_obj).unwrap(); assert_eq!(json, vec![ &json!({"name": "친구3", "age": 30}), &json!({"name": "친구1", "age": 20}) ]); // call a second time let json = first_friend.select(&json_obj).unwrap(); assert_eq!(json, vec![ &json!({"name": "친구3", "age": 30}), &json!({"name": "친구1", "age": 20}) ]);
Implementations
impl Compiled
[src]
impl Compiled
[src]Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Compiled
impl Send for Compiled
impl Sync for Compiled
impl Unpin for Compiled
impl UnwindSafe for Compiled
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more