pub enum Attr<T> {
DoubleQ(T, T),
SingleQ(T, T),
Unquoted(T, T),
Empty(T),
}
Expand description
A struct representing a key/value XML or HTML attribute.
Variants§
DoubleQ(T, T)
Attribute with value enclosed in double quotes ("
). Attribute key and
value provided. This is a canonical XML-style attribute.
SingleQ(T, T)
Attribute with value enclosed in single quotes ('
). Attribute key and
value provided. This is an XML-style attribute.
Unquoted(T, T)
Attribute with value not enclosed in quotes. Attribute key and value
provided. This is HTML-style attribute, it can be returned in HTML-mode
parsing only. In an XML mode AttrError::UnquotedValue
will be raised
instead.
Attribute value can be invalid according to the HTML specification,
in particular, it can contain "
, '
, =
, <
, and `
characters. The absence of the >
character is nevertheless guaranteed,
since the parser extracts events based on them even before the start
of parsing attributes.
Empty(T)
Attribute without value. Attribute key provided. This is HTML-style attribute,
it can be returned in HTML-mode parsing only. In XML mode
AttrError::ExpectedEq
will be raised instead.
Implementations§
Trait Implementations§
Source§impl<T> From<Attr<T>> for (T, Option<T>)
Unpacks attribute key and value into tuple of this two elements.
None
value element is returned only for Attr::Empty
variant.
impl<T> From<Attr<T>> for (T, Option<T>)
Unpacks attribute key and value into tuple of this two elements.
None
value element is returned only for Attr::Empty
variant.