Skip to main content

Context

Struct Context 

Source
pub struct Context<'a> {
    pub expression: &'a str,
    pub runtime: &'a Runtime,
    pub offset: usize,
    /* private fields */
}
Expand description

Context object used during expression evaluation.

The Context struct carries state needed by the interpreter and functions, including the expression string (for error messages), runtime (for function lookup), current AST offset, and expref side-channel table.

Fields§

§expression: &'a str

Expression string being interpreted.

§runtime: &'a Runtime

JMESPath runtime used for function lookup.

§offset: usize

Current AST offset (for error reporting).

Implementations§

Source§

impl<'a> Context<'a>

Source

pub fn new(expression: &'a str, runtime: &'a Runtime) -> Context<'a>

Creates a new context.

Source

pub fn get_expref(&self, id: usize) -> Option<&Ast>

Retrieves an expref AST by index.

Source

pub fn push_scope(&mut self, bindings: HashMap<String, Value>)

Push a new scope onto the scope stack.

Source

pub fn pop_scope(&mut self)

Pop the innermost scope from the scope stack.

Source

pub fn get_variable(&self, name: &str) -> Option<Value>

Look up a variable in the scope stack.

Auto Trait Implementations§

§

impl<'a> Freeze for Context<'a>

§

impl<'a> !RefUnwindSafe for Context<'a>

§

impl<'a> Send for Context<'a>

§

impl<'a> Sync for Context<'a>

§

impl<'a> Unpin for Context<'a>

§

impl<'a> UnsafeUnpin for Context<'a>

§

impl<'a> !UnwindSafe for Context<'a>

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V