[][src]Trait fasteval::evaler::Evaler

pub trait Evaler: Debug {
    fn eval(
        &self,
        slab: &Slab,
        ns: &mut impl EvalNamespace
    ) -> Result<f64, Error>;
fn _var_names(&self, slab: &Slab, dst: &mut BTreeSet<String>); fn var_names(&self, slab: &Slab) -> BTreeSet<String> { ... } }

You must use this trait so you can call .eval().

Required methods

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.

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.

Loading content...

Provided methods

fn var_names(&self, slab: &Slab) -> BTreeSet<String>

Returns a list of variables and custom functions that are used by this Expression/Instruction.

Loading content...

Implementors

impl Evaler for Instruction[src]

impl Evaler for StdFunc[src]

impl Evaler for UnaryOp[src]

impl Evaler for Value[src]

impl Evaler for Expression[src]

impl Evaler for PrintFunc[src]

Loading content...