Trait meval::ArgGuard[][src]

pub trait ArgGuard {
    fn to_arg_guard<'a, F: Fn(&[f64]) -> f64 + 'a>(
        func: F
    ) -> Rc<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.


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

Implementations on Foreign Types

impl ArgGuard for usize

impl ArgGuard for RangeFrom<usize>

impl ArgGuard for RangeTo<usize>

impl ArgGuard for Range<usize>

impl ArgGuard for RangeFull