Skip to main content

Event

Enum Event 

Source
pub enum Event<'r, 'src> {
    StartElement(StartTag<'r, 'src>),
    EndElement(EndTag<'src>),
    Text(Text<'src>),
    CData(CData<'src>),
    Comment(Comment<'src>),
    Pi(Pi<'src>),
    EntityRef(EntityRef<'src>),
    Eof,
}
Expand description

A streaming XML event with lazy access to its payload.

Returned by XmlReader::next. Each variant wraps a tag struct whose methods (name(), attrs(), as_str(), etc.) extract data on demand. For an eager API that fills a caller-owned buffer see XmlReader::next_into which returns EventInto.

Variants§

§

StartElement(StartTag<'r, 'src>)

An opening (or empty-element) start tag.

§

EndElement(EndTag<'src>)

A closing tag. Emitted once for each StartElement, including for empty elements (<br/> emits StartElement then EndElement).

§

Text(Text<'src>)

Character data between tags.

§

CData(CData<'src>)

A <![CDATA[…]]> section.

§

Comment(Comment<'src>)

An XML comment.

§

Pi(Pi<'src>)

A processing instruction.

§

EntityRef(EntityRef<'src>)

An unresolved entity reference (&name;) — emitted only when ParseOptions::resolve_entities is false. Carries the entity name without the surrounding & / ;.

§

Eof

The document has been fully consumed.

Trait Implementations§

Source§

impl<'r, 'src> Debug for Event<'r, 'src>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'r, 'src> !RefUnwindSafe for Event<'r, 'src>

§

impl<'r, 'src> !UnwindSafe for Event<'r, 'src>

§

impl<'r, 'src> Freeze for Event<'r, 'src>

§

impl<'r, 'src> Send for Event<'r, 'src>

§

impl<'r, 'src> Sync for Event<'r, 'src>

§

impl<'r, 'src> Unpin for Event<'r, 'src>

§

impl<'r, 'src> UnsafeUnpin for Event<'r, 'src>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.