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: PartialOrd> PartialOrd for Attr<T>
impl<T: PartialOrd> PartialOrd for Attr<T>
impl<T: Eq> Eq for Attr<T>
impl<T> StructuralPartialEq for Attr<T>
Auto Trait Implementations§
impl<T> Freeze for Attr<T>where
T: Freeze,
impl<T> RefUnwindSafe for Attr<T>where
T: RefUnwindSafe,
impl<T> Send for Attr<T>where
T: Send,
impl<T> Sync for Attr<T>where
T: Sync,
impl<T> Unpin for Attr<T>where
T: Unpin,
impl<T> UnwindSafe for Attr<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)