diff --git a/src/nodes/eval.rs b/src/nodes/eval.rs index cbc139b..25fe190 100644 --- a/src/nodes/eval.rs +++ b/src/nodes/eval.rs @@ -127,6 +127,17 @@ fn collapse_toplevel(nodes: &mut Vec, mut end: usize) -> Result<(), Error> Ok(()) } +impl Operator { + fn apply_to(&self, rhs: &mut Float, lhs: Float) { + match self { + Self::Plus => Float::add_from(rhs, lhs), + Self::Minus => Float::sub_from(rhs, lhs), + Self::Mult => Float::mul_from(rhs, lhs), + Self::Div => Float::div_from(rhs, lhs), + Self::Exp => Float::pow_from(rhs, lhs), + } + } +} impl Function { fn apply_to(&self, n: &mut Float) { match self { @@ -145,17 +156,6 @@ impl Function { } } } -impl Operator { - fn apply_to(&self, rhs: &mut Float, lhs: Float) { - match self { - Self::Plus => Float::add_from(rhs, lhs), - Self::Minus => Float::sub_from(rhs, lhs), - Self::Mult => Float::mul_from(rhs, lhs), - Self::Div => Float::div_from(rhs, lhs), - Self::Exp => Float::pow_from(rhs, lhs), - } - } -} #[cfg(test)] mod tests {