1use core::fmt;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub enum Error {
5 UnsortedKeys,
6 EmptyInput,
7 InvalidEpsilon,
8}
9
10impl fmt::Display for Error {
11 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12 match self {
13 Error::UnsortedKeys => write!(f, "keys must be sorted and non-decreasing"),
14 Error::EmptyInput => write!(f, "input data cannot be empty"),
15 Error::InvalidEpsilon => write!(f, "epsilon must be greater than 0"),
16 }
17 }
18}
19
20#[cfg(feature = "std")]
21impl std::error::Error for Error {}