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
sourceimpl<T> From<Attr<T>> for (T, Option<T>)
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.
sourceimpl<T: Ord> Ord for Attr<T>
impl<T: Ord> Ord for Attr<T>
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl<T: PartialOrd> PartialOrd<Attr<T>> for Attr<T>
impl<T: PartialOrd> PartialOrd<Attr<T>> for Attr<T>
sourcefn partial_cmp(&self, other: &Attr<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &Attr<T>) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more