pub struct EvalOptions {
pub max_node_evaluations: Option<u64>,
pub max_iterations: Option<u64>,
pub cancellation_token: Option<Arc<AtomicBool>>,
pub lenient: bool,
}Expand description
Configuration for resource limits, cancellation, and error handling during template evaluation.
Create with EvalOptions::new() and chain builder methods:
use weaver_lang::EvalOptions;
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
let token = Arc::new(AtomicBool::new(false));
let opts = EvalOptions::new()
.max_node_evaluations(10_000)
.max_iterations(1_000)
.cancellation_token(token)
.lenient(true);Fields§
§max_node_evaluations: Option<u64>Maximum number of AST node evaluations before the evaluator
returns a ResourceLimit error.
None means unlimited.
max_iterations: Option<u64>Maximum number of loop iterations (across all foreach blocks)
before the evaluator returns a
ResourceLimit error.
None means unlimited.
cancellation_token: Option<Arc<AtomicBool>>An external flag that can be set to true to cancel an
in-progress evaluation. Checked after each node evaluation.
lenient: boolWhen true, undefined variables, failed processor/command calls,
and trigger/document errors render as their original raw syntax
instead of producing hard errors.
Useful for preview/authoring contexts where partial results are preferred over failure.
Implementations§
Source§impl EvalOptions
impl EvalOptions
Sourcepub fn max_node_evaluations(self, limit: u64) -> Self
pub fn max_node_evaluations(self, limit: u64) -> Self
Set the maximum number of AST node evaluations.
Sourcepub fn max_iterations(self, limit: u64) -> Self
pub fn max_iterations(self, limit: u64) -> Self
Set the maximum number of loop iterations.
Sourcepub fn cancellation_token(self, token: Arc<AtomicBool>) -> Self
pub fn cancellation_token(self, token: Arc<AtomicBool>) -> Self
Attach a cancellation token. Set the AtomicBool to true from
another thread to abort evaluation.
Trait Implementations§
Source§impl Clone for EvalOptions
impl Clone for EvalOptions
Source§fn clone(&self) -> EvalOptions
fn clone(&self) -> EvalOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more