EvalEngine

Struct EvalEngine 

Source
pub struct EvalEngine<'arena> { /* private fields */ }
Expand description

Reusable evaluation engine to avoid allocations

Implementations§

Source§

impl<'arena> EvalEngine<'arena>

Source

pub fn new(arena: &'arena Bump) -> Self

Create a new evaluation engine with arena for zero-allocation evaluation

Source

pub fn set_local_functions( &mut self, functions: Option<&'arena RefCell<ExpressionFunctionMap>>, )

Set the local expression functions for this evaluation

Source

pub fn arena_reset(&mut self)

Reset the engine for reuse with new expression More comprehensive than arena_clear_stacks - also clears caches and context

Source

pub fn eval( &mut self, ast: &'arena AstExpr<'arena>, ctx: Option<Rc<EvalContext>>, ) -> Result<Real, ExprError>

Evaluate an expression

Source

pub fn set_param_overrides(&mut self, params: BatchParamMap)

Set parameter overrides for batch evaluation. These take precedence over context variables during lookup.

Source

pub fn clear_param_overrides(&mut self)

Clear parameter overrides.

Source

pub fn with_param_overrides<F, R>(&mut self, params: BatchParamMap, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Execute a function with parameter overrides, ensuring they are cleared afterwards. This provides RAII-style cleanup for safe batch evaluation.

Auto Trait Implementations§

§

impl<'arena> Freeze for EvalEngine<'arena>

§

impl<'arena> !RefUnwindSafe for EvalEngine<'arena>

§

impl<'arena> !Send for EvalEngine<'arena>

§

impl<'arena> !Sync for EvalEngine<'arena>

§

impl<'arena> Unpin for EvalEngine<'arena>

§

impl<'arena> !UnwindSafe for EvalEngine<'arena>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.