wolfxl-core 0.4.0

Pure-Rust xlsx reader with Excel number-format-aware cell rendering. Backs the wolfxl-cli previewer.
Documentation
use std::fmt;

#[derive(Debug)]
pub enum Error {
    Io(std::io::Error),
    Xlsx(String),
    SheetNotFound(String),
    InvalidRange(String),
}

impl fmt::Display for Error {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Error::Io(e) => write!(f, "io error: {e}"),
            Error::Xlsx(s) => write!(f, "xlsx error: {s}"),
            Error::SheetNotFound(s) => write!(f, "sheet not found: {s:?}"),
            Error::InvalidRange(s) => write!(f, "invalid range: {s}"),
        }
    }
}

impl std::error::Error for Error {
    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
        match self {
            Error::Io(e) => Some(e),
            _ => None,
        }
    }
}

impl From<std::io::Error> for Error {
    fn from(e: std::io::Error) -> Self {
        Error::Io(e)
    }
}

pub type Result<T> = std::result::Result<T, Error>;