use core::error::Error;
use core::fmt::{self, Display, Formatter};
#[derive(Debug, Eq, PartialEq)]
pub enum HtmlFromStrError {
MissingHash,
UnknownFormat,
UnknownName,
}
impl Error for HtmlFromStrError { }
impl Display for HtmlFromStrError {
#[inline]
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
match *self {
Self::MissingHash
=> write!(f, "html hexadecimal colour is missing prefixed hash `#`"),
Self::UnknownFormat
=> write!(f, "html colour is of an otherwise unknown format"),
Self::UnknownName
=> write!(f, "html named colour is unknown"),
}
}
}