pub trait Evaler: Debug {
// Required methods
fn eval(
&self,
slab: &Slab,
ns: &mut impl EvalNamespace,
) -> Result<f64, Error>;
fn _var_names(&self, slab: &Slab, dst: &mut BTreeSet<String>);
// Provided method
fn var_names(&self, slab: &Slab) -> BTreeSet<String> { ... }
}
Expand description
You must use
this trait so you can call .eval()
.
Required Methods§
Sourcefn eval(&self, slab: &Slab, ns: &mut impl EvalNamespace) -> Result<f64, Error>
fn eval(&self, slab: &Slab, ns: &mut impl EvalNamespace) -> Result<f64, Error>
Evaluate this Expression
/Instruction
and return an f64
.
Returns a fasteval::Error
if there are any problems, such as undefined variables.
Sourcefn _var_names(&self, slab: &Slab, dst: &mut BTreeSet<String>)
fn _var_names(&self, slab: &Slab, dst: &mut BTreeSet<String>)
Don’t call this directly. Use var_names()
instead.
This exists because of ternary short-circuits; they prevent us from getting a complete list of vars just by doing eval() with a clever callback.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.