pub enum Node<'a> {
Tag(HTMLTag<'a>),
Raw(Bytes<'a>),
Comment(Bytes<'a>),
}Expand description
An HTML Node
Variants§
Tag(HTMLTag<'a>)
A regular HTML element/tag
Raw(Bytes<'a>)
Raw text (no particular HTML element)
Comment(Bytes<'a>)
Comment ()
Implementations§
Source§impl<'a> Node<'a>
impl<'a> Node<'a>
Sourcepub fn inner_text<'s, 'p: 's>(&'s self, parser: &'p Parser<'a>) -> Cow<'s, str>
pub fn inner_text<'s, 'p: 's>(&'s self, parser: &'p Parser<'a>) -> Cow<'s, str>
Returns the inner text of this node
Sourcepub fn outer_html<'s>(&'s self, parser: &Parser<'a>) -> Cow<'s, str>
pub fn outer_html<'s>(&'s self, parser: &Parser<'a>) -> Cow<'s, str>
Returns the outer HTML of this node
Sourcepub fn inner_html<'s>(&'s self, parser: &Parser<'a>) -> Cow<'s, str>
pub fn inner_html<'s>(&'s self, parser: &Parser<'a>) -> Cow<'s, str>
Returns the inner HTML of this node
Sourcepub fn children(&self) -> Option<Children<'a, '_>>
pub fn children(&self) -> Option<Children<'a, '_>>
Returns an iterator over subnodes (“children”) of this HTML tag, if this is a tag
Sourcepub fn find_node<F>(&self, parser: &Parser<'a>, f: &mut F) -> Option<NodeHandle>
pub fn find_node<F>(&self, parser: &Parser<'a>, f: &mut F) -> Option<NodeHandle>
Calls the given closure with each tag as parameter
The closure must return a boolean, indicating whether it should stop iterating
Returning true will break the loop and return a handle to the node
Sourcepub fn as_tag_mut(&mut self) -> Option<&mut HTMLTag<'a>>
pub fn as_tag_mut(&mut self) -> Option<&mut HTMLTag<'a>>
Tries to coerce this node into a HTMLTag variant
Sourcepub fn as_comment(&self) -> Option<&Bytes<'a>>
pub fn as_comment(&self) -> Option<&Bytes<'a>>
Tries to coerce this node into a comment, returning the text
Sourcepub fn as_comment_mut(&mut self) -> Option<&mut Bytes<'a>>
pub fn as_comment_mut(&mut self) -> Option<&mut Bytes<'a>>
Tries to coerce this node into a comment, returning the text
Sourcepub fn as_raw(&self) -> Option<&Bytes<'a>>
pub fn as_raw(&self) -> Option<&Bytes<'a>>
Tries to coerce this node into a raw text node, returning the text
“Raw text nodes” are nodes that are not HTML tags, but just text
Sourcepub fn as_raw_mut(&mut self) -> Option<&mut Bytes<'a>>
pub fn as_raw_mut(&mut self) -> Option<&mut Bytes<'a>>
Tries to coerce this node into a mutable raw text node, returning the text
“Raw text nodes” are nodes that are not HTML tags, but just text