use thiserror::Error;
#[derive(Debug, Error)]
pub enum AtxError {
#[error("input too short: needed at least {needed} bytes, got {got}")]
TooShort { needed: usize, got: usize },
#[error("not an AAPL container (expected magic `AAPL\\r\\n\\x1a\\n`)")]
BadMagic,
#[error("chunk `{tag}` is malformed or truncated at offset 0x{offset:x}")]
BadChunk { tag: String, offset: usize },
#[error("required chunk `{0}` not found in container")]
ChunkNotFound(&'static str),
#[error("no texture payload found (neither `astc` nor `LZFS` chunk)")]
PayloadNotFound,
#[error("ASTC decode failed: {0}")]
AstcDecode(String),
#[error("LZFSE decompression failed: {0}")]
LzfseDecode(String),
#[error("LZFSE support not enabled (rebuild with feature `lzfse`)")]
LzfseUnavailable,
#[error("io error: {0}")]
Io(#[from] std::io::Error),
}
pub type Result<T> = core::result::Result<T, AtxError>;