diff --git a/src/reduction.rs b/src/reduction.rs index 463f10a7..8cf6f3ca 100644 --- a/src/reduction.rs +++ b/src/reduction.rs @@ -1,4 +1,4 @@ -use std::io; +use std::{fmt, io}; use crate::allocator::NodePtr; use crate::cost::Cost; @@ -11,6 +11,14 @@ pub struct Reduction(pub Cost, pub NodePtr); pub type Response = Result; +impl fmt::Display for EvalErr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "Error at {:?}: {}", self.0, self.1) + } +} + +impl std::error::Error for EvalErr {} + impl From for io::Error { fn from(v: EvalErr) -> Self { Self::new(io::ErrorKind::Other, v.1)