pub trait ArgGuard {
// Required method
fn to_arg_guard<'a, F: Fn(&[f64]) -> f64 + 'a>(
self,
func: F,
) -> Rc<dyn Fn(&[f64]) -> Result<f64, FuncEvalError> + 'a>;
}Expand description
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§
fn to_arg_guard<'a, F: Fn(&[f64]) -> f64 + 'a>( self, func: F, ) -> Rc<dyn Fn(&[f64]) -> Result<f64, FuncEvalError> + 'a>
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.