Func

Trait Func 

Source
pub trait Func<N: Num> {
    // Required method
    fn eval(&self, args: &[Term<N>], ctx: &Context<N>) -> Calculation<N>;
}
Expand description

Implemented by functions defined in a context

Required Methods§

Source

fn eval(&self, args: &[Term<N>], ctx: &Context<N>) -> Calculation<N>

Evaluate the function in this context with the given arguments. When implementing, simply evaluate the arguments with the context and return an Err(MathError::IncorrectArguments) if there are too many or too few.

Implementors§

Source§

impl<T, N: Num> Func<N> for T
where T: Fn(&[Term<N>], &Context<N>) -> Calculation<N>,

Blanket impl for closures