Struct jmespath::Expression
source · [−]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
sourceimpl<'a> Expression<'a>
impl<'a> Expression<'a>
sourcepub fn new<S>(expression: S, ast: Ast, runtime: &'a Runtime) -> Expression<'a> where
S: Into<String>,
pub fn new<S>(expression: S, ast: Ast, runtime: &'a Runtime) -> Expression<'a> where
S: Into<String>,
Creates a new JMESPath expression.
Normally you will create expressions using either jmespath::compile()
or using a jmespath::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
sourceimpl<'a> Clone for Expression<'a>
impl<'a> Clone for Expression<'a>
sourcefn clone(&self) -> Expression<'a>
fn clone(&self) -> Expression<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a> Debug for Expression<'a>
impl<'a> Debug for Expression<'a>
sourceimpl<'a> Display for Expression<'a>
impl<'a> Display for Expression<'a>
sourceimpl<'a> PartialEq<Expression<'a>> for Expression<'a>
impl<'a> PartialEq<Expression<'a>> for Expression<'a>
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Expression<'a>
impl<'a> !Send for Expression<'a>
impl<'a> !Sync for Expression<'a>
impl<'a> Unpin for Expression<'a>
impl<'a> !UnwindSafe for Expression<'a>
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more