[][src]Struct scraper::element_ref::ElementRef

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

Wrapper around a reference to an element node.

This wrapper implements the Element trait from the selectors crate, which allows it to be matched against CSS selectors.

Methods

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

pub fn wrap(node: NodeRef<'a, Node>) -> Option<Self>[src]

Wraps a NodeRef only if it references a Node::Element.

pub fn value(&self) -> &'a Element[src]

Returns the Element referenced by self.

pub fn select<'b>(&self, selector: &'b Selector) -> Select<'a, 'b>[src]

Returns an iterator over descendent elements matching a selector.

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

Returns the HTML of this element.

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

Returns the inner HTML of this element.

pub fn text(&self) -> Text<'a>[src]

Returns an iterator over descendent text nodes.

Methods from Deref<Target = NodeRef<'a, Node>>

pub fn id(&self) -> NodeId[src]

Returns the ID of this node.

pub fn tree(&self) -> &'a Tree<T>[src]

Returns the tree owning this node.

pub fn value(&self) -> &'a T[src]

Returns the value of this node.

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

Returns the parent of this node.

pub fn prev_sibling(&self) -> Option<NodeRef<'a, T>>[src]

Returns the previous sibling of this node.

pub fn next_sibling(&self) -> Option<NodeRef<'a, T>>[src]

Returns the next sibling of this node.

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

Returns the first child of this node.

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

Returns the last child of this node.

pub fn has_siblings(&self) -> bool[src]

Returns true if this node has siblings.

pub fn has_children(&self) -> bool[src]

Returns true if this node has children.

pub fn ancestors(&self) -> Ancestors<'a, T>[src]

Returns an iterator over ancestors.

pub fn prev_siblings(&self) -> PrevSiblings<'a, T>[src]

Returns an iterator over previous siblings.

pub fn next_siblings(&self) -> NextSiblings<'a, T>[src]

Returns an iterator over next siblings.

pub fn first_children(&self) -> FirstChildren<'a, T>[src]

Returns an iterator over first children.

pub fn last_children(&self) -> LastChildren<'a, T>[src]

Returns an iterator over last children.

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

Returns an iterator over children.

pub fn traverse(&self) -> Traverse<'a, T>[src]

Returns an iterator which traverses the subtree starting at this node.

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

Returns an iterator over this node and its descendants.

Trait Implementations

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

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

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

impl<'a> Deref for ElementRef<'a>[src]

type Target = NodeRef<'a, Node>

The resulting type after dereferencing.

impl<'a> Element for ElementRef<'a>[src]

Note: will never match against non-tree-structure pseudo-classes.

type Impl = Simple

impl<'a> Eq for ElementRef<'a>[src]

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

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

impl<'a> StructuralEq for ElementRef<'a>[src]

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

Auto Trait Implementations

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

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

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

impl<'a> Unpin for ElementRef<'a>

impl<'a> !UnwindSafe for ElementRef<'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.