#[doc(hidden)]
#[derive(Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum ResidentHtj2kEncodeError {
InvalidInput(&'static str),
Unsupported(&'static str),
Declined,
Accelerator(crate::J2kEncodeStageError),
Resource(crate::EncodeError),
Backend(crate::EncodeError),
}
impl core::fmt::Display for ResidentHtj2kEncodeError {
fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::InvalidInput(reason) => {
write!(formatter, "invalid resident HTJ2K encode input: {reason}")
}
Self::Unsupported(reason) => {
write!(formatter, "unsupported resident HTJ2K encode: {reason}")
}
Self::Declined => {
formatter.write_str("resident HTJ2K tile accelerator declined encode")
}
Self::Accelerator(source) => {
write!(formatter, "resident HTJ2K accelerator failed: {source}")
}
Self::Resource(error) => write!(formatter, "resident HTJ2K resource failure: {error}"),
Self::Backend(error) => write!(formatter, "resident HTJ2K encode failed: {error}"),
}
}
}
impl core::error::Error for ResidentHtj2kEncodeError {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match self {
Self::Accelerator(error) => Some(error),
Self::Resource(error) | Self::Backend(error) => Some(error),
Self::InvalidInput(_) | Self::Unsupported(_) | Self::Declined => None,
}
}
}