use core::fmt;
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum StatsError {
Shape {
message: &'static str,
},
RankDeficient {
rank: usize,
ncols: usize,
},
Backend(String),
}
impl fmt::Display for StatsError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Shape { message } => write!(f, "shape error: {message}"),
Self::RankDeficient { rank, ncols } => {
write!(f, "rank deficient: rank={rank} ncols={ncols}")
}
Self::Backend(msg) => write!(f, "backend error: {msg}"),
}
}
}
impl std::error::Error for StatsError {}