use std::fmt;
#[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum Error {
NotEnoughData {
needed: usize,
got: usize,
},
ParseNotation,
NoValidComplexity,
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Error::NotEnoughData { needed, got } => write!(
f,
"Need at least {needed} distinct input sizes to infer a complexity, got {got}"
),
Error::ParseNotation => write!(f, "Can't convert string to a complexity model"),
Error::NoValidComplexity => write!(f, "No valid complexity could be inferred"),
}
}
}
impl std::error::Error for Error {}