pub struct Expression<'a> { /* private fields */ }
Expand description
A compiled JMESPath expression.
The compiled expression can be used multiple times without incurring
the cost of re-parsing the expression each time. The expression may
be shared between threads if JMESPath is compiled with the sync
feature, which forces the use of an Arc
instead of an Rc
for
runtime variables.
Implementations§
Source§impl<'a> Expression<'a>
impl<'a> Expression<'a>
Sourcepub fn new<S>(expression: S, ast: Ast, runtime: &'a Runtime) -> Expression<'a>
pub fn new<S>(expression: S, ast: Ast, runtime: &'a Runtime) -> Expression<'a>
Creates a new JMESPath expression.
Normally you will create expressions using either jmespatch::compile()
or using a jmespatch::Runtime.
Sourcepub fn search<T: ToJmespath>(&self, data: T) -> Result<Rcvar, JmespathError>
pub fn search<T: ToJmespath>(&self, data: T) -> Result<Rcvar, JmespathError>
Returns the result of searching data with the compiled expression.
The SearchResult contains a JMESPath Rcvar, or a reference counted Variable. This value can be used directly like a JSON object. Alternatively, Variable does implement Serde serialzation and deserialization, so it can easily be marshalled to another type.
Trait Implementations§
Source§impl<'a> Clone for Expression<'a>
impl<'a> Clone for Expression<'a>
Source§fn clone(&self) -> Expression<'a>
fn clone(&self) -> Expression<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more