use std::{
error::Error,
fmt::{self, Debug},
};
pub type Result<T> = std::result::Result<T, Box<dyn Error>>;
#[derive(Debug)]
pub struct BoundError<T: fmt::Display>(pub (T, T), pub (T, T));
impl<T: fmt::Display> fmt::Display for BoundError<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"BoundError: ({}, {}) is out of bounds for ({}, {})",
self.0 .0, self.0 .1, self.1 .0, self.1 .1
)
}
}
impl<T: fmt::Display + Debug> Error for BoundError<T> {}