Struct jsonpath_rust::JsonPathFinder

source ·
pub struct JsonPathFinder { /* private fields */ }
Expand description

The base structure stitching the json instance and jsonpath instance

Implementations§

source§

impl JsonPathFinder

source

pub fn new(json: Box<Value>, path: Box<JsonPathInst>) -> Self

creates a new instance of JsonPathFinder

source

pub fn new_with_cfg( json: Box<Value>, path: Box<JsonPathInst>, cfg: JsonPathConfig ) -> Self

source

pub fn set_cfg(&mut self, cfg: JsonPathConfig)

sets a cfg with a new one

source

pub fn set_path(&mut self, path: Box<JsonPathInst>)

updates a path with a new one

source

pub fn set_json(&mut self, json: Box<Value>)

updates a json with a new one

source

pub fn set_json_str(&mut self, json: &str) -> Result<(), String>

updates a json from string and therefore can be some parsing errors

source

pub fn set_path_str(&mut self, path: &str) -> Result<(), String>

updates a path from string and therefore can be some parsing errors

source

pub fn from_str(json: &str, path: &str) -> Result<Self, String>

create a new instance from string and therefore can be some parsing errors

source

pub fn from_str_with_cfg( json: &str, path: &str, cfg: JsonPathConfig ) -> Result<Self, String>

source

pub fn instance(&self) -> PathInstance<'_>

creates an instance to find a json slice from the json

source

pub fn find_slice(&self) -> Vec<JsonPathValue<'_, Value>>

finds a slice of data in the set json. The result is a vector of references to the incoming structure.

source

pub fn find(&self) -> Value

finds a slice of data and wrap it with Value::Array by cloning the data. Returns either an array of elements or Json::Null if the match is incorrect.

source

pub fn find_as_path(&self) -> Value

finds a path of the values. If the values has been obtained by moving the data out of the initial json the path is absent.

Trait Implementations§

source§

impl Debug for JsonPathFinder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.