Skip to main content

HtmlEvent

Enum HtmlEvent 

Source
pub enum HtmlEvent<'a> {
    StartElement {
        name: &'a str,
        attributes: HtmlAttrs<'a>,
    },
    EndElement {
        name: &'a str,
    },
    Text(&'a str),
    Comment(&'a str),
    Doctype {
        name: &'a str,
        public_id: &'a str,
        system_id: &'a str,
    },
    Eof,
}
Expand description

A tree-construction event emitted by the streaming HTML parser.

Variants§

§

StartElement

An element start tag. Self-closing source forms (<br/>) and void elements (<br>) both emit a single StartElement; for void elements no matching EndElement follows. For non-void elements the matching EndElement follows after the element’s content events.

Fields

§name: &'a str

The lower-cased element name, e.g. "div".

§attributes: HtmlAttrs<'a>

Iterable view over the element’s attributes.

§

EndElement

An element end tag. Emitted for every non-void element that was opened, including ones implicitly closed by html5ever’s recovery.

Fields

§name: &'a str

The lower-cased element name being closed.

§

Text(&'a str)

A character data run. Adjacent text events from html5ever are coalesced into a single event by the streaming sink, so consumers don’t see arbitrarily-fragmented text.

§

Comment(&'a str)

An HTML comment, with the surrounding <!-- / --> delimiters stripped.

§

Doctype

The document <!DOCTYPE> declaration. Emitted at most once per document, before any element events.

Fields

§name: &'a str
§public_id: &'a str
§system_id: &'a str
§

Eof

End of input. Subsequent calls to HtmlReader::next keep returning Eof.

Trait Implementations§

Source§

impl<'a> Debug for HtmlEvent<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for HtmlEvent<'a>

§

impl<'a> RefUnwindSafe for HtmlEvent<'a>

§

impl<'a> Send for HtmlEvent<'a>

§

impl<'a> Sync for HtmlEvent<'a>

§

impl<'a> Unpin for HtmlEvent<'a>

§

impl<'a> UnsafeUnpin for HtmlEvent<'a>

§

impl<'a> UnwindSafe for HtmlEvent<'a>

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.