[][src]Struct jmespatch::Expression

pub struct Expression<'a> { /* fields omitted */ }

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.

Methods

impl<'a> Expression<'a>[src]

pub fn new<S>(expression: S, ast: Ast, runtime: &'a Runtime) -> Expression<'a> where
    S: Into<String>, 
[src]

Creates a new JMESPath expression.

Normally you will create expressions using either jmespatch::compile() or using a jmespatch::Runtime.

pub fn search<T: ToJmespath>(&self, data: T) -> Result<Rcvar, JmespathError>[src]

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.

pub fn as_str(&self) -> &str[src]

Returns the JMESPath expression from which the Expression was compiled.

Note that this is the same value that is returned by calling to_string.

pub fn as_ast(&self) -> &Ast[src]

Returns the AST of the parsed JMESPath expression.

This can be useful for debugging purposes, caching, etc.

Trait Implementations

impl<'a> Clone for Expression<'a>[src]

impl<'a> Debug for Expression<'a>[src]

impl<'a> Display for Expression<'a>[src]

fn fmt(&self, f: &mut Formatter) -> Result[src]

Shows the jmespath expression as a string.

impl<'a> PartialEq<Expression<'a>> for Expression<'a>[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.