use cssparser::ToCss;
use precomputed_hash::PrecomputedHash;
use std::fmt::Write;
#[derive(Debug, Default, PartialEq, Eq, Clone)]
pub(crate) struct LocalName(html5ever::LocalName);
impl LocalName {
pub(crate) fn into_inner(self) -> html5ever::LocalName {
self.0
}
#[inline]
pub(crate) fn as_inner(&self) -> &html5ever::LocalName {
&self.0
}
pub(crate) fn as_bytes(&self) -> &[u8] {
self.0.as_bytes()
}
}
impl PartialEq<LocalName> for html5ever::LocalName {
fn eq(&self, other: &LocalName) -> bool {
self.eq(&other.0)
}
}
impl<'a> From<&'a str> for LocalName {
fn from(value: &'a str) -> Self {
LocalName(html5ever::LocalName::from(value))
}
}
impl ToCss for LocalName {
fn to_css<W>(&self, dest: &mut W) -> std::fmt::Result
where
W: Write,
{
dest.write_str(self.0.as_ref())
}
}
impl PrecomputedHash for LocalName {
fn precomputed_hash(&self) -> u32 {
self.0.precomputed_hash()
}
}