use core::fmt;
pub type Result<T> = core::result::Result<T, Error>;
#[derive(Debug)]
pub struct Error(ErrorKind);
impl Error {
pub fn new<E>(kind: ErrorKind, _error: E) -> Error {
Self(kind)
}
pub fn other<E>(_error: E) -> Error {
Self(ErrorKind::Other)
}
#[inline]
#[must_use]
pub fn kind(&self) -> ErrorKind {
self.0
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[non_exhaustive]
pub enum ErrorKind {
InvalidInput,
Interrupted,
UnexpectedEof,
Other,
}
impl fmt::Display for ErrorKind {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(self, f)
}
}