diff options
Diffstat (limited to 'src/number.rs')
-rw-r--r-- | src/number.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/number.rs b/src/number.rs index 5ea7949..d40e50a 100644 --- a/src/number.rs +++ b/src/number.rs @@ -1,7 +1,7 @@ use std::cmp::max; use std::convert::TryFrom; use std::num::TryFromIntError; -use std::ops::Add; +use std::ops::{Add, Mul}; #[derive(Clone)] pub struct Number { @@ -59,3 +59,17 @@ impl Add for Number { } } } + +impl Mul for Number { + type Output = Number; + + fn mul(self, rhs: Self) -> Self::Output { + if self.integer_part.len() > 1 || rhs.integer_part.len() > 1 { + todo!() + } else { + Number { + integer_part: vec![self.integer_part[0] * rhs.integer_part[0]] + } + } + } +} |