peacock-crest 0.1.0

A CSS library for parsing and applying styles to in-memory DOM structures
Documentation
pub type Result<T> = core::result::Result<T, Error>;

#[derive(Debug, derive_more::From)]
pub enum Error {
    #[from]
    FsError(std::io::Error),

    #[from]
    SelectorError(crate::selector::SelectorExpectError),
    #[from]
    CssError(crate::syntax::CssExpectError),

    Generic(String),
}

impl Error {
    pub fn generic(val: impl std::fmt::Display) -> Self {
        Self::Generic(val.to_string())
    }
}

impl core::fmt::Display for Error {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{self:?}")
    }
}

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