Skip to main content

HtmlSliceExt

Trait HtmlSliceExt 

Source
pub trait HtmlSliceExt {
    // Required method
    fn iter_with_dom_indices(&self) -> impl Iterator<Item = (&HtmlNode, usize)>;
}
Expand description

An extension trait for [HtmlNode].

Required Methods§

Source

fn iter_with_dom_indices(&self) -> impl Iterator<Item = (&HtmlNode, usize)>

Iterates over nodes alongside the indices as they would be observed in the final DOM.

  • Tags receive the index of the preceding node and don’t advance the cursor.

  • For indexing purposes, consecutive text nodes are considered as groups. They receive the same index as they are not distinguishable on the DOM level.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl HtmlSliceExt for [HtmlNode]

Implementors§