1use std::{
2 error::Error,
3 fmt::{self, Display, Formatter},
4};
5
6#[derive(Debug, PartialEq)]
9pub enum MatrixError {
10 NotSquare,
12 Singular,
14 UnequalRows,
16}
17
18impl Display for MatrixError {
19 fn fmt(&self, f: &mut Formatter) -> fmt::Result {
20 let out = match *self {
21 Self::NotSquare => "provided matrix isn't square",
22 Self::Singular => "provided matrix is singular",
23 Self::UnequalRows => "provided array has unequal rows",
24 };
25 write!(f, "{out}")
26 }
27}
28
29impl Error for MatrixError {}