aboutsummaryrefslogtreecommitdiff
path: root/src/operation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/operation.rs')
-rw-r--r--src/operation.rs9
1 files changed, 5 insertions, 4 deletions
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)),
)*]