Struct jsonpath_plus::JsonPath
source · [−]pub struct JsonPath { /* private fields */ }
Expand description
A compiled JSON path. Can be used to match against items any number of times, preventing recompilation of the same pattern many times.
Implementations
sourceimpl JsonPath
impl JsonPath
sourcepub fn compile(pattern: &str) -> Result<JsonPath, ParseError>
pub fn compile(pattern: &str) -> Result<JsonPath, ParseError>
Compile a JSON path, which can be used to match items multiple times.
Errors
- If the provided pattern fails to parse as a valid JSON path
sourcepub fn find<'a>(&self, value: &'a Value) -> Vec<&'a Value>
pub fn find<'a>(&self, value: &'a Value) -> Vec<&'a Value>
Find this pattern in the provided JSON value
sourcepub fn delete(&self, value: &Value) -> Value
pub fn delete(&self, value: &Value) -> Value
Delete all items matched by this pattern on the provided JSON value, and return the resulting object
sourcepub fn replace(&self, value: &Value, f: impl FnMut(&Value) -> Value) -> Value
pub fn replace(&self, value: &Value, f: impl FnMut(&Value) -> Value) -> Value
Replace items matched by this pattern on the provided JSON value, filling them with the value returned by the provided function, then return the resulting object
Auto Trait Implementations
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnwindSafe for Path
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more