diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-01-17 23:54:52 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-01-17 23:54:52 +0100 |
| commit | 95ba627a9c5e4e6e1d79f7aaff1854eb831511b4 (patch) | |
| tree | 177d58d387143d644ce7ad2c97eb30032e226533 /src/operation.rs | |
| parent | 9cc61497ed8a2336f33407d3262181e4ac3b46cb (diff) | |
hand context on to Function trait
Diffstat (limited to 'src/operation.rs')
| -rw-r--r-- | src/operation.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/operation.rs b/src/operation.rs index a61ae1f..7eca774 100644 --- a/src/operation.rs +++ b/src/operation.rs @@ -1,14 +1,15 @@ use crate::complex::Complex; -pub type Operator = dyn Fn(Complex, Complex) -> Complex; +pub type Operator = fn(Complex, Complex) -> Complex; +#[derive(Clone)] pub struct Operation { sign: char, - func: Box<Operator> + func: Operator } impl Operation { - pub fn new(sign: char, func: Box<Operator>) -> Self { + pub fn new(sign: char, func: Operator) -> Self { Self { sign, func } } |