Trait meval::ArgGuard [] [src]

pub trait ArgGuard {
    fn to_arg_guard<'a, F: Fn(&[f64]) -> f64 + 'a>(self,
                                               func: F)
                                               -> Box<Fn(&[f64]) -> Result<f64, FuncEvalError> + 'a>; }

Trait for types that can specify the number of required arguments for a function with a variable number of arguments.

Example

let mut ctx = meval::Context::empty();

// require exactly 2 arguments
ctx.funcn("sum_two", |xs| xs[0] + xs[1], 2);

// allow an arbitrary number of arguments
ctx.funcn("sum", |xs| xs.iter().sum(), ..);

Required Methods

Implementors