diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-01-18 18:29:10 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-01-18 18:29:10 +0100 |
| commit | 1713618d4cc0194674f91fd2d24ef2de88f21784 (patch) | |
| tree | 1cb39a43019c071ca127cb9f609c045327798de3 /src/operation.rs | |
| parent | 670c1881af4680ce7c248498528d14b98210af3f (diff) | |
create small iced demo
Diffstat (limited to 'src/operation.rs')
| -rw-r--r-- | src/operation.rs | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/operation.rs b/src/operation.rs deleted file mode 100644 index 7eca774..0000000 --- a/src/operation.rs +++ /dev/null @@ -1,32 +0,0 @@ -use crate::complex::Complex; - -pub type Operator = fn(Complex, Complex) -> Complex; - -#[derive(Clone)] -pub struct Operation { - sign: char, - func: Operator -} - -impl Operation { - pub fn new(sign: char, func: Operator) -> Self { - Self { sign, func } - } - - pub fn sign(&self) -> char { - self.sign - } - - pub fn evaluate(&self, a: Complex, b: Complex) -> Complex { - (self.func)(a, b) - } -} - -#[macro_export] -macro_rules! operations { - {$($x:expr => $y:expr), *} => { - vec![$( - Operation::new($x, Box::new($y)), - )*] - }; -} |