Enum Ast

Source
pub enum Ast {
Show 18 variants 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>, },
}
Expand description

A JMESPath expression abstract syntax tree.

Variants§

§

Comparison

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

Fields

§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

§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

§offset: usize

Approximate absolute position in the parsed expression.

§

Expref

Used by functions to dynamically evaluate argument values.

Fields

§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

§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

§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

§offset: usize

Approximate absolute position in the parsed expression.

§name: String

Field name to extract.

§

Index

Extracts an index from a Vec.

Fields

§offset: usize

Approximate absolute position in the parsed expression.

§idx: i32

Index to extract

§

Literal

Resolves to a literal value.

Fields

§offset: usize

Approximate absolute position in the parsed expression.

§value: Rcvar

Literal value

§

MultiList

Evaluates to a list of evaluated expressions.

Fields

§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

§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

§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

§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

§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

§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

§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

§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

§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§

Source§

impl Clone for Ast

Source§

fn clone(&self) -> Ast

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Ast

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Ast

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Ast

Source§

fn eq(&self, other: &Ast) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Ast

Auto Trait Implementations§

§

impl Freeze for Ast

§

impl RefUnwindSafe for Ast

§

impl !Send for Ast

§

impl !Sync for Ast

§

impl Unpin for Ast

§

impl UnwindSafe for Ast

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.