atx_reader 0.1.0

Parser and decoder for Apple .atx texture archives (AAPL container with ASTC payload), as produced by tools like Cellebrite UFED iOS exports.
Documentation
use thiserror::Error;

/// Errors produced while parsing or decoding a `.atx` file.
#[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>;