From 77cf9aa7535a1d9481f0bd3caeea26e2b85c5019 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Wed, 17 Jan 2024 22:30:02 +0100 Subject: migrate from f64 to own complex --- src/operation.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/operation.rs') diff --git a/src/operation.rs b/src/operation.rs index 861fb5a..1ee3d5c 100644 --- a/src/operation.rs +++ b/src/operation.rs @@ -1,5 +1,6 @@ +use crate::complex::Complex; -pub type Operator = dyn Fn(f64, f64) -> f64; +pub type Operator = dyn Fn(Complex, Complex) -> Complex; pub struct Operation { sign: char, @@ -15,14 +16,14 @@ impl Operation { self.sign } - pub fn evaluate(&self, a: f64, b: f64) -> f64 { + pub fn evaluate(&self, a: Complex, b: Complex) -> Complex { (self.func)(a, b) } } #[macro_export] -macro_rules! opvec { - ($(($x:expr, $y:expr)), *) => { +macro_rules! operations { + ({$($x:expr => $y:expr), *}) => { vec![$( Operation::new($x, Box::new($y)), )*] -- cgit v1.2.3-70-g09d2