refactor: make Operator/Function ordering consistent
This commit is contained in:
parent
56e8fbca99
commit
9bd0318702
1 changed files with 11 additions and 11 deletions
|
|
@ -127,6 +127,17 @@ fn collapse_toplevel(nodes: &mut Vec<Node>, 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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue