diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2023-02-09 15:26:30 -0330 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2023-02-09 15:26:30 -0330 |
| commit | 1f6fa5a58030f4ff2adde61e7652d1956e407510 (patch) | |
| tree | 35dc8b7ba5693daaad8eaf5b4e18bba235af988d /src/input.rs | |
| parent | 9c04c7b1f8d6911b5a148398d5b4ab416f2136f5 (diff) | |
| download | pfc-1f6fa5a58030f4ff2adde61e7652d1956e407510.zip | |
simplify Function method and rename Calculator method
Diffstat (limited to 'src/input.rs')
| -rw-r--r-- | src/input.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/input.rs b/src/input.rs index a80ce11..e7783fb 100644 --- a/src/input.rs +++ b/src/input.rs @@ -33,7 +33,7 @@ impl Calculator { KeyCode::Enter if self.input_buffer.len() > 0 => { if let Ok(func) = Function::parse(&self.input_buffer) { if let Some(f) = self.stack.pop() { - self.stack.push(func.func()(f)); + self.stack.push(func.call_on(f)); } } else { self.stack.push(self.input_buffer.parse::<f64>().unwrap()); @@ -56,7 +56,7 @@ impl Calculator { } else if let Ok(op) = Operator::parse(c) { self.stack.push(self.input_buffer.parse::<f64>().unwrap()); self.input_buffer = String::new(); - self.op(op); + self.perform_operation(op); } else { self.input_buffer.push(c); } |