use core::fmt;
pub type Result<T> = core::result::Result<T, SimdSieveError>;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum SimdSieveError {
EmptyPatternSet,
PatternLimitExceeded(usize),
EmptyPattern {
index: usize,
},
}
impl fmt::Display for SimdSieveError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::EmptyPatternSet => {
write!(f, "sieve construction failed: empty pattern set provided")
}
Self::PatternLimitExceeded(c) => write!(
f,
"sieve construction failed: provided {c} patterns, but hardware router only supports maximum 16"
),
Self::EmptyPattern { index } => write!(
f,
"sieve construction failed: pattern at index {index} is empty"
),
}
}
}
impl std::error::Error for SimdSieveError {}