From 95ba627a9c5e4e6e1d79f7aaff1854eb831511b4 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Wed, 17 Jan 2024 23:54:52 +0100 Subject: hand context on to Function trait --- src/operation.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/operation.rs') 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 + func: Operator } impl Operation { - pub fn new(sign: char, func: Box) -> Self { + pub fn new(sign: char, func: Operator) -> Self { Self { sign, func } } -- cgit v1.2.3-70-g09d2