[][src]Struct select::node::Node

pub struct Node<'a> { /* fields omitted */ }

A single node of an HTML document. Nodes may be HTML elements, comments, or text nodes.

Implementations

impl<'a> Node<'a>[src]

pub fn new(document: &'a Document, index: usize) -> Option<Node<'a>>[src]

Create a Node referring to the indexth Node of a document.

pub fn index(&self) -> usize[src]

Get the index of this Node in its Document.

pub fn raw(&self) -> &'a Raw[src]

Obtain the inner representation of this Node.

pub fn data(&self) -> &'a Data[src]

Get the text node, HTML element, or comment from a Node.

pub fn name(&self) -> Option<&'a str>[src]

Get the name of a Node if it is an HTML element, or None otherwise.

pub fn attr(&self, name: &str) -> Option<&'a str>[src]

Get the value of the attribute name from a Node representing a HTML element.

pub fn attrs(&self) -> Attrs<'a>[src]

Get an iterator over the names and values of attributes of the Element. Returns an empty iterator for non Element nodes.

pub fn parent(&self) -> Option<Node<'a>>[src]

pub fn prev(&self) -> Option<Node<'a>>[src]

pub fn next(&self) -> Option<Node<'a>>[src]

pub fn first_child(&self) -> Option<Node<'a>>[src]

pub fn last_child(&self) -> Option<Node<'a>>[src]

pub fn text(&self) -> String[src]

Get the combined textual content of a Node and all of its children.

pub fn html(&self) -> String[src]

Serialize a Node to an HTML string.

pub fn inner_html(&self) -> String[src]

Serialize a Node's children to an HTML string.

pub fn find<P: Predicate>(&self, predicate: P) -> Find<'a, P>[src]

Search for Nodes fulfilling predicate in the descendants of a Node.

pub fn is<P: Predicate>(&self, p: P) -> bool[src]

Evaluate a predicate on this Node.

pub fn as_text(&self) -> Option<&'a str>[src]

Get the text of a text Node, or None if the node is not text.

pub fn as_comment(&self) -> Option<&'a str>[src]

Get the text of a comment Node, or None if the node is not a comment.

pub fn children(&self) -> Children<'a>[src]

Construct an iterator over a Node's child Nodes.

pub fn descendants(&self) -> Descendants<'a>[src]

Construct an iterator over a Node's descendant (transitive children) Nodes.

Trait Implementations

impl<'a> Clone for Node<'a>[src]

impl<'a> Copy for Node<'a>[src]

impl<'a> Debug for Node<'a>[src]

impl<'a> PartialEq<Node<'a>> for Node<'a>[src]

impl<'a> Serialize for Node<'a>[src]

impl<'a> StructuralPartialEq for Node<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Node<'a>

impl<'a> !Send for Node<'a>

impl<'a> !Sync for Node<'a>

impl<'a> Unpin for Node<'a>

impl<'a> !UnwindSafe for Node<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.