Skip to main content

EvaluateContext

Struct EvaluateContext 

Source
pub struct EvaluateContext<'engine, 'json, T> { /* private fields */ }
Expand description

The information required to evaluate an expression

Implementations§

Source§

impl<'engine, 'json> EvaluateContext<'engine, 'json, ()>

Source

pub fn new(engine: &'engine Engine<()>, value: &'json Value) -> Self

Create a new evaluation context with the provided value

Source§

impl<'engine, 'json, T> EvaluateContext<'engine, 'json, T>

Source

pub fn new_with_state( engine: &'engine Engine<T>, value: &'json Value, state: T, ) -> Self

Create a new evaluation context with the provided value and data

Source

pub fn with_previous(self, previous_value: &'json Value) -> Self

Add the previous data to use when evaluating

Previous data is what gets used when an expression uses LAST FieldName.

Source

pub fn set_previous(self, previous_value: Option<&'json Value>) -> Self

Set the previous data to use when evaluating

Previous data is what gets used when an expression uses LAST FieldName.

Source

pub fn value(&self) -> &'json Value

Get a reference to the value within this context

Source

pub fn previous_value(&self) -> Option<&'json Value>

Get a reference to the previous value within this context, if available

Source

pub fn engine(&self) -> &'engine Engine<T>

Get a reference to the engine used when creating this context

Source

pub fn state(&self) -> &T

Get a reference to the state used when creating this context

Source

pub fn state_mut(&mut self) -> &mut T

Get a mutable reference to the state used when creating this context

Trait Implementations§

Source§

impl<'engine, 'json, T: Clone> Clone for EvaluateContext<'engine, 'json, T>

Source§

fn clone(&self) -> EvaluateContext<'engine, 'json, T>

Returns a duplicate 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<'engine, 'json, T: Copy> Copy for EvaluateContext<'engine, 'json, T>

Auto Trait Implementations§

§

impl<'engine, 'json, T> Freeze for EvaluateContext<'engine, 'json, T>
where T: Freeze,

§

impl<'engine, 'json, T> !RefUnwindSafe for EvaluateContext<'engine, 'json, T>

§

impl<'engine, 'json, T> !Send for EvaluateContext<'engine, 'json, T>

§

impl<'engine, 'json, T> !Sync for EvaluateContext<'engine, 'json, T>

§

impl<'engine, 'json, T> Unpin for EvaluateContext<'engine, 'json, T>
where T: Unpin,

§

impl<'engine, 'json, T> UnsafeUnpin for EvaluateContext<'engine, 'json, T>
where T: UnsafeUnpin,

§

impl<'engine, 'json, T> !UnwindSafe for EvaluateContext<'engine, 'json, T>

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, 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.