layout-cat 0.1.0

Box-model layout: cascade + block layout over a dom-cat tree using css-cat stylesheets. Produces a LayoutBox tree with positions and dimensions. No mut, no Rc/Arc, no interior mutability, no panics, exhaustive matches. Fourth sub-crate of a Servo-replacement webview runtime targeting Tauri.
//! Layout error type.

use css_cat::Error as CssError;
use dom_cat::Error as DomError;

/// All errors `layout-cat` can produce.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Error {
    /// A CSS-parser error.
    Css(CssError),
    /// A DOM error.
    Dom(DomError),
}

impl From<CssError> for Error {
    fn from(value: CssError) -> Self {
        Self::Css(value)
    }
}

impl From<DomError> for Error {
    fn from(value: DomError) -> Self {
        Self::Dom(value)
    }
}

impl std::fmt::Display for Error {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Css(e) => write!(f, "css error: {e}"),
            Self::Dom(e) => write!(f, "dom error: {e}"),
        }
    }
}

impl std::error::Error for Error {}