Enum quick_xml::events::attributes::Attr
source · 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>)
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.
source§impl<T: Ord> Ord for Attr<T>
impl<T: Ord> Ord for Attr<T>
source§impl<T: PartialEq> PartialEq<Attr<T>> for Attr<T>
impl<T: PartialEq> PartialEq<Attr<T>> for Attr<T>
source§impl<T: PartialOrd> PartialOrd<Attr<T>> for Attr<T>
impl<T: PartialOrd> PartialOrd<Attr<T>> for Attr<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more