aboutsummaryrefslogtreecommitdiff
path: root/src/number.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-03-07 22:27:59 -0700
committerMelody Horn <melody@boringcactus.com>2021-03-07 22:27:59 -0700
commit204ee3854d3d45338ed9f1659d44f23062bfac77 (patch)
tree8b58d90d7b9ad367f6be1f336cd6146f6417e87c /src/number.rs
parentb8bb816d72217c1afdb18858481db737e52a4e7f (diff)
downloadhope-main.tar.gz
hope-main.zip
expand the hardcoded system so it draws a dot under the cursorHEADmain
Diffstat (limited to 'src/number.rs')
-rw-r--r--src/number.rs16
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]]
+ }
+ }
+ }
+}