use crate::cells::Coord;
use ca_rules::ParseRuleError;
use std::{
error,
fmt::{self, Display, Formatter},
};
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Error {
GetCellError(Coord),
SetCellError(Coord),
ParseRuleError(ParseRuleError),
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
Error::GetCellError(coord) => write!(f, "Unable to get the state of cell {:?}.", coord),
Error::SetCellError(coord) => write!(f, "Unable to set cell at {:?}.", coord),
Error::ParseRuleError(e) => write!(f, "{}", e),
}
}
}
impl error::Error for Error {}