From 141a9aef307744ef7337b15ad9fc65a4171aac97 Mon Sep 17 00:00:00 2001 From: rvcas Date: Thu, 8 Dec 2022 10:56:53 -0500 Subject: [PATCH] feat: impl Sub for ExBudget --- crates/uplc/src/machine/cost_model.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/uplc/src/machine/cost_model.rs b/crates/uplc/src/machine/cost_model.rs index 98be17e7..0131d0e1 100644 --- a/crates/uplc/src/machine/cost_model.rs +++ b/crates/uplc/src/machine/cost_model.rs @@ -47,6 +47,17 @@ impl Default for ExBudget { } } +impl std::ops::Sub for ExBudget { + type Output = Self; + + fn sub(self, rhs: Self) -> Self::Output { + ExBudget { + mem: self.mem - rhs.mem, + cpu: self.cpu - rhs.cpu, + } + } +} + #[derive(Default)] pub struct CostModel { pub machine_costs: MachineCosts,