[−][src]Struct select::node::Node
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 index
th 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) -> impl Iterator<Item = (&'a str, &'a str)>
[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 select<P: Predicate>(&self, predicate: P) -> Select<'a, P>ⓘ
[src]
Search for Nodes fulfilling predicate
in the descendants of a Node.
pub fn find<P: Predicate>(&self, predicate: P) -> Select<'a, P>ⓘ
[src]
renamed to select()
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>ⓘNotable traits for Descendants<'a>
impl<'a> Iterator for Descendants<'a> type Item = Node<'a>;
[src]
Notable traits for Descendants<'a>
impl<'a> Iterator for Descendants<'a> type Item = Node<'a>;
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]
fn serialize<S: Serializer>(
&self,
serializer: &mut S,
traversal_scope: TraversalScope
) -> Result<()>
[src]
&self,
serializer: &mut S,
traversal_scope: TraversalScope
) -> Result<()>
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,