use core::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum TiffError {
InvalidData(String),
Unsupported(String),
}
impl TiffError {
pub fn invalid(msg: impl Into<String>) -> Self {
Self::InvalidData(msg.into())
}
pub fn unsupported(msg: impl Into<String>) -> Self {
Self::Unsupported(msg.into())
}
}
impl fmt::Display for TiffError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::InvalidData(s) => write!(f, "invalid data: {s}"),
Self::Unsupported(s) => write!(f, "unsupported: {s}"),
}
}
}
impl std::error::Error for TiffError {}
pub type Result<T> = core::result::Result<T, TiffError>;