pub struct EvalCtx<'r> {
pub ctx: Context,
pub registry: &'r Registry,
pub resolver: Option<&'r mut dyn Resolver>,
}Expand description
Bundles the variable context, function registry, and reference resolver for use during evaluation. Passed to lazy functions so they can recursively evaluate sub-expressions.
References that are not bound as local variables (e.g. a LAMBDA parameter)
are read through resolver; see crate::Resolver. When resolver is
None (the default, via EvalCtx::new) every such reference reads as
Value::Empty, preserving the historical contract of
crate::Engine::evaluate.
Fields§
§ctx: Context§registry: &'r Registry§resolver: Option<&'r mut dyn Resolver>Resolver for references not bound as local variables. None ⇒ such
references read as Value::Empty (the historical
crate::Engine::evaluate contract).
Implementations§
Source§impl<'r> EvalCtx<'r>
impl<'r> EvalCtx<'r>
Sourcepub fn new(ctx: Context, registry: &'r Registry) -> Self
pub fn new(ctx: Context, registry: &'r Registry) -> Self
Build an EvalCtx with no resolver: unbound references read as
Value::Empty. Use EvalCtx::with_resolver to supply real
workbook semantics.
Sourcepub fn with_resolver(
ctx: Context,
registry: &'r Registry,
resolver: &'r mut dyn Resolver,
) -> Self
pub fn with_resolver( ctx: Context, registry: &'r Registry, resolver: &'r mut dyn Resolver, ) -> Self
Build an EvalCtx that resolves references through resolver.
Sourcepub fn resolve_ref(&mut self, r: &Ref) -> Value
pub fn resolve_ref(&mut self, r: &Ref) -> Value
Resolve a reference that was not bound as a local variable, delegating
to EvalCtx::resolver when present and falling back to
Value::Empty otherwise.