1use crate::allocator::Allocator;
2use crate::reduction::EvalErr;
3
4pub type Cost = u64;
5
6pub fn check_cost(a: &Allocator, cost: Cost, max_cost: Cost) -> Result<(), EvalErr> {
7 if cost > max_cost {
8 Err(EvalErr(a.null(), "cost exceeded".into()))
9 } else {
10 Ok(())
11 }
12}