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/lib.rs | |
| parent | 9c04c7b1f8d6911b5a148398d5b4ab416f2136f5 (diff) | |
| download | pfc-1f6fa5a58030f4ff2adde61e7652d1956e407510.zip | |
simplify Function method and rename Calculator method
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -8,7 +8,7 @@ pub struct Calculator { } impl Calculator { - fn op(&mut self, op: Operator) { + fn perform_operation(&mut self, op: Operator) { let rhs = match self.stack.pop() { Some(f) => f, None => { @@ -70,11 +70,11 @@ impl Function { } } - fn func(&self) -> impl Fn(f64) -> f64 { + fn call_on(&self, f: f64) -> f64 { match self { - Self::Sin => |f: f64| f.sin(), - Self::Cos => |f: f64| f.cos(), - Self::Tan => |f: f64| f.tan(), + Self::Sin => f.sin(), + Self::Cos => f.cos(), + Self::Tan => f.tan(), } } } |