use alloc::vec::Vec;
#[derive(Clone, Debug, PartialEq)]
pub enum Token<'a> {
StartTag {
name: &'a str,
attrs: Vec<(&'a str, AttrValue<'a>)>,
self_closing: bool,
},
EndTag {
name: &'a str,
},
Text(&'a str),
Comment(&'a str),
Doctype(&'a str),
Cdata(&'a str),
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum AttrValue<'a> {
Quoted(&'a str),
Unquoted(&'a str),
Empty,
}
impl<'a> AttrValue<'a> {
pub fn as_str(&self) -> &'a str {
match self {
AttrValue::Quoted(s) | AttrValue::Unquoted(s) => s,
AttrValue::Empty => "",
}
}
}