Struct rsonpath_lib::query::JsonPathQuery
source · pub struct JsonPathQuery { /* private fields */ }
Expand description
JSONPath query structure represented by the root link of the
JsonPathQueryNode
list.
Implementations§
source§impl JsonPathQuery
impl JsonPathQuery
sourcepub fn root(&self) -> &JsonPathQueryNode
pub fn root(&self) -> &JsonPathQueryNode
Retrieve reference to the root node.
It is guaranteed that the root is the JsonPathQueryNode::Root
variant and always exists.
sourcepub fn parse(query_string: &str) -> Result<Self, QueryError>
pub fn parse(query_string: &str) -> Result<Self, QueryError>
Parse a query string into a JsonPathQuery
.
Errors
Will return a QueryError
if the query_string
does
not conform to the JSONPath grammar. See its documentation
for details.
sourcepub fn new(node: Box<JsonPathQueryNode>) -> Self
pub fn new(node: Box<JsonPathQueryNode>) -> Self
Create a query from a root node.
If node is not the JsonPathQueryNode::Root
variant it will be
automatically wrapped into a JsonPathQueryNode::Root
node.