pub enum Event {
XmlDeclaration(EventMetrics, XmlVersion),
StartElement(EventMetrics, QName, AttrMap),
EndElement(EventMetrics),
Text(EventMetrics, String),
}Expand description
§High-level, logical XML document parts
The term Event is borrowed from SAX terminology. Each Event
refers to a bit of the XML document which has been parsed.
In contrast to the RawEvent, observing a Event from a
Parser guarantees that the XML document has been well-formed and
namespace-well-formed up to this point (for the caveats which, in contrast,
exist about observing a RawEvent, see RawParser).
Each event has EventMetrics attached which give information about the
number of bytes from the input stream used to generate the event.
Variants§
XmlDeclaration(EventMetrics, XmlVersion)
The XML declaration.
This mirrors RawEvent::XmlDeclaration.
Tuple Fields
0: EventMetricsNumber of bytes contributing to this event.
This includes all bytes from the opening <? until and including
the closing ?>.
1: XmlVersionXML version number
StartElement(EventMetrics, QName, AttrMap)
The start of an XML element.
Tuple Fields
0: EventMetricsNumber of bytes contributing to this event.
If this is the root element, this also includes any whitespace between the XML declaration and the start of the root element.
EndElement(EventMetrics)
The end of an XML element.
The parser enforces that start/end pairs are correctly nested.
Tuple Fields
0: EventMetricsNumber of bytes contributing to this event.
The number of bytes may be zero if this event is emitted in
response to a /> in an element header, because the bytes for
/> are accounted for in the corresponding
Self::StartElement.
Text(EventMetrics, String)
Text CData.
This mirrors RawEvent::Text.
Note: Multiple consecutive Text events may be emitted for long
sections of text or because of implementation details in the
processing.
Tuple Fields
0: EventMetricsNumber of bytes contributing to this event.
Note that due to the expansion of character references and the processing of CDATA sections, the number of bytes consumed will generally be not equal to the number of bytes in emitted.
Implementations§
source§impl Event
impl Event
sourcepub fn metrics(&self) -> &EventMetrics
pub fn metrics(&self) -> &EventMetrics
Return the EventMetrics of the event
Trait Implementations§
source§impl PartialEq for Event
impl PartialEq for Event
impl Eq for Event
impl StructuralPartialEq for Event
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)