pub struct ExpressionEvaluator<T: EvaluationDomain> { /* private fields */ }Expand description
Implementations§
Source§impl<T: EvaluationDomain + PowfExtension> ExpressionEvaluator<T>
impl<T: EvaluationDomain + PowfExtension> ExpressionEvaluator<T>
Sourcepub fn param_count(&self) -> usize
pub fn param_count(&self) -> usize
Return the number of parameters expected by this evaluator.
Sourcepub fn result_count(&self) -> usize
pub fn result_count(&self) -> usize
Return the number of results produced by this evaluator.
Sourcepub fn stack_size(&self) -> usize
pub fn stack_size(&self) -> usize
Return the stack size required to evaluate this expression.
Callers reusing a stack buffer across evaluations should
pre-allocate a Vec with this capacity.
Sourcepub fn evaluate(&self, params: &[T]) -> Result<Vec<T>>
pub fn evaluate(&self, params: &[T]) -> Result<Vec<T>>
Evaluate the expression with the given parameter values.
Returns a vector of result values. The number of results equals
result_indices.len().
§Errors
Returns EvaluationError if the number of parameters does not
match, or if an arithmetic error occurs (e.g. division by zero).
§Example
let result = evaluator.evaluate(&[2.0_f64])?;
assert_eq!(result.len(), 1);Sourcepub fn evaluate_with_stack(
&self,
params: &[T],
stack: &mut Vec<T>,
results: &mut Vec<T>,
) -> Result<()>
pub fn evaluate_with_stack( &self, params: &[T], stack: &mut Vec<T>, results: &mut Vec<T>, ) -> Result<()>
Evaluate the expression, reusing caller-provided buffers.
stack must have capacity for at least
stack_size elements (it is
resized as needed); results is filled with the result values.
Reusing buffers across calls avoids per-evaluation heap
allocation, which matters for streaming and batch workloads.
§Errors
Returns EvaluationError if the number of parameters does not
match, or if an arithmetic error occurs.
Source§impl<T: EvaluationDomain + PowfExtension> ExpressionEvaluator<T>
impl<T: EvaluationDomain + PowfExtension> ExpressionEvaluator<T>
Sourcepub fn compile_with(atom: Atom<'_>, map: FunctionMap<T>) -> Result<Self>
pub fn compile_with(atom: Atom<'_>, map: FunctionMap<T>) -> Result<Self>
Compile an Atom with a FunctionMap for user-defined functions.
Sourcepub fn compile_multi(atoms: &[Atom<'_>]) -> Result<Self>
pub fn compile_multi(atoms: &[Atom<'_>]) -> Result<Self>
Compile multiple Atoms into one multi-output evaluator,
sharing common subexpressions across all outputs.
Sourcepub fn compile_multi_with(
atoms: &[Atom<'_>],
map: FunctionMap<T>,
) -> Result<Self>
pub fn compile_multi_with( atoms: &[Atom<'_>], map: FunctionMap<T>, ) -> Result<Self>
Compile multiple Atoms with a FunctionMap into one
multi-output evaluator.
Auto Trait Implementations§
impl<T> !RefUnwindSafe for ExpressionEvaluator<T>
impl<T> !UnwindSafe for ExpressionEvaluator<T>
impl<T> Freeze for ExpressionEvaluator<T>
impl<T> Send for ExpressionEvaluator<T>where
T: Send,
impl<T> Sync for ExpressionEvaluator<T>where
T: Sync,
impl<T> Unpin for ExpressionEvaluator<T>where
T: Unpin,
impl<T> UnsafeUnpin for ExpressionEvaluator<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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