[][src]Enum jmespatch::ast::Ast

pub enum Ast {
    Comparison {
        offset: usize,
        comparator: Comparator,
        lhs: Box<Ast>,
        rhs: Box<Ast>,
    },
    Condition {
        offset: usize,
        predicate: Box<Ast>,
        then: Box<Ast>,
    },
    Identity {
        offset: usize,
    },
    Expref {
        offset: usize,
        ast: Box<Ast>,
    },
    Flatten {
        offset: usize,
        node: Box<Ast>,
    },
    Function {
        offset: usize,
        name: String,
        args: Vec<Ast>,
    },
    Field {
        offset: usize,
        name: String,
    },
    Index {
        offset: usize,
        idx: i32,
    },
    Literal {
        offset: usize,
        value: Rcvar,
    },
    MultiList {
        offset: usize,
        elements: Vec<Ast>,
    },
    MultiHash {
        offset: usize,
        elements: Vec<KeyValuePair>,
    },
    Not {
        offset: usize,
        node: Box<Ast>,
    },
    Projection {
        offset: usize,
        lhs: Box<Ast>,
        rhs: Box<Ast>,
    },
    ObjectValues {
        offset: usize,
        node: Box<Ast>,
    },
    And {
        offset: usize,
        lhs: Box<Ast>,
        rhs: Box<Ast>,
    },
    Or {
        offset: usize,
        lhs: Box<Ast>,
        rhs: Box<Ast>,
    },
    Slice {
        offset: usize,
        start: Option<i32>,
        stop: Option<i32>,
        step: i32,
    },
    Subexpr {
        offset: usize,
        lhs: Box<Ast>,
        rhs: Box<Ast>,
    },
}

A JMESPath expression abstract syntax tree.

Variants

Comparison

Compares two nodes using a comparator, returning true/false.

Fields of Comparison

offset: usize

Approximate absolute position in the parsed expression.

comparator: Comparator

Comparator that compares the two results

lhs: Box<Ast>

Left hand side of the comparison

rhs: Box<Ast>

Right hand side of the comparison

Condition

If predicate evaluates to a truthy value, returns the result then

Fields of Condition

offset: usize

Approximate absolute position in the parsed expression.

predicate: Box<Ast>

The predicate to test.

then: Box<Ast>

The node to traverse if the predicate is truthy.

Identity

Returns the current node.

Fields of Identity

offset: usize

Approximate absolute position in the parsed expression.

Expref

Used by functions to dynamically evaluate argument values.

Fields of Expref

offset: usize

Approximate absolute position in the parsed expression.

ast: Box<Ast>

Node to execute

Flatten

Evaluates the node, then flattens it one level.

Fields of Flatten

offset: usize

Approximate absolute position in the parsed expression.

node: Box<Ast>

Node to execute and flatten

Function

Function name and a vec or function argument expressions.

Fields of Function

offset: usize

Approximate absolute position in the parsed expression.

name: String

Function name to invoke.

args: Vec<Ast>

Function arguments.

Field

Extracts a key by name from a map.

Fields of Field

offset: usize

Approximate absolute position in the parsed expression.

name: String

Field name to extract.

Index

Extracts an index from a Vec.

Fields of Index

offset: usize

Approximate absolute position in the parsed expression.

idx: i32

Index to extract

Literal

Resolves to a literal value.

Fields of Literal

offset: usize

Approximate absolute position in the parsed expression.

value: Rcvar

Literal value

MultiList

Evaluates to a list of evaluated expressions.

Fields of MultiList

offset: usize

Approximate absolute position in the parsed expression.

elements: Vec<Ast>

Elements of the list

MultiHash

Evaluates to a map of key value pairs.

Fields of MultiHash

offset: usize

Approximate absolute position in the parsed expression.

elements: Vec<KeyValuePair>

Elements of the hash

Not

Evaluates to true/false based on if the expression is not truthy.

Fields of Not

offset: usize

Approximate absolute position in the parsed expression.

node: Box<Ast>

node to negate

Projection

Evaluates LHS, and pushes each value through RHS.

Fields of Projection

offset: usize

Approximate absolute position in the parsed expression.

lhs: Box<Ast>

Left hand side of the projection.

rhs: Box<Ast>

Right hand side of the projection.

ObjectValues

Evaluates LHS. If it resolves to an object, returns a Vec of values.

Fields of ObjectValues

offset: usize

Approximate absolute position in the parsed expression.

node: Box<Ast>

Node to extract object values from.

And

Evaluates LHS. If not truthy returns. Otherwise evaluates RHS.

Fields of And

offset: usize

Approximate absolute position in the parsed expression.

lhs: Box<Ast>

Left hand side of the expression.

rhs: Box<Ast>

Right hand side of the expression.

Or

Evaluates LHS. If truthy returns. Otherwise evaluates RHS.

Fields of Or

offset: usize

Approximate absolute position in the parsed expression.

lhs: Box<Ast>

Left hand side of the expression.

rhs: Box<Ast>

Right hand side of the expression.

Slice

Returns a slice of a vec, using start, stop, and step.

Fields of Slice

offset: usize

Approximate absolute position in the parsed expression.

start: Option<i32>

Starting index

stop: Option<i32>

Stopping index

step: i32

Step amount between extractions.

Subexpr

Evaluates RHS, then provides that value to the evaluation of RHS.

Fields of Subexpr

offset: usize

Approximate absolute position in the parsed expression.

lhs: Box<Ast>

Left hand side of the expression.

rhs: Box<Ast>

Right hand side of the expression.

Trait Implementations

impl Clone for Ast[src]

impl Debug for Ast[src]

impl Display for Ast[src]

impl PartialEq<Ast> for Ast[src]

impl StructuralPartialEq for Ast[src]

Auto Trait Implementations

impl !RefUnwindSafe for Ast

impl !Send for Ast

impl !Sync for Ast

impl Unpin for Ast

impl !UnwindSafe for Ast

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.