use std::{
error::Error,
fmt::{self, Display, Formatter},
};
#[derive(Debug, PartialEq)]
pub enum MatrixError {
NotSquare,
Singular,
UnequalRows,
}
impl Display for MatrixError {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
let out = match *self {
Self::NotSquare => "provided matrix isn't square",
Self::Singular => "provided matrix is singular",
Self::UnequalRows => "provided array has unequal rows",
};
write!(f, "{out}")
}
}
impl Error for MatrixError {}