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

pub struct ElementRef<'a> {
    // some 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]

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

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

fn value(&self) -> &Element

Returns the Element referenced by self.

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

Returns an iterator over descendent elements matching a selector.

fn text(&self) -> Text

Returns an iterator over descendent text nodes.

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

fn value(&self) -> &'a T

Returns the value of this node.

fn id(&self) -> NodeId<T>

Returns the ID of this node.

fn parent(&self) -> Option<NodeRef<'a, T>>

Returns a reference to this node's parent.

fn prev_sibling(&self) -> Option<NodeRef<'a, T>>

Returns a reference to this node's previous sibling.

fn next_sibling(&self) -> Option<NodeRef<'a, T>>

Returns a reference to this node's next sibling.

fn first_child(&self) -> Option<NodeRef<'a, T>>

Returns a reference to this node's first child.

fn last_child(&self) -> Option<NodeRef<'a, T>>

Returns a reference to this node's last child.

fn has_siblings(&self) -> bool

Returns true if this node has siblings.

fn has_children(&self) -> bool

Returns true if this node has children.

fn ancestors(&self) -> Ancestors<'a, T>

Returns an iterator over this node's ancestors.

fn prev_siblings(&self) -> PrevSiblings<'a, T>

Returns an iterator over this node's previous siblings.

fn next_siblings(&self) -> NextSiblings<'a, T>

Returns an iterator over this node's next siblings.

fn children(&self) -> Children<'a, T>

Returns an iterator over this node's children.

fn first_children(&self) -> FirstChildren<'a, T>

Returns an iterator over this node's first children.

fn last_children(&self) -> LastChildren<'a, T>

Returns an iterator over this node's last children.

fn traverse(&self) -> Traverse<'a, T>

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

Trait Implementations

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

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

type Impl = Simple

fn parent_element(&self) -> Option<Self>

fn first_child_element(&self) -> Option<Self>

fn last_child_element(&self) -> Option<Self>

fn prev_sibling_element(&self) -> Option<Self>

fn next_sibling_element(&self) -> Option<Self>

fn is_html_element_in_html_document(&self) -> bool

fn get_local_name(&self) -> &Atom

fn get_namespace(&self) -> &Namespace

fn match_non_ts_pseudo_class(&self, _pc: ()) -> bool

fn get_id(&self) -> Option<Atom>

fn has_class(&self, name: &Atom) -> bool

fn match_attr<F>(&self, attr: &AttrSelector, test: F) -> bool where F: Fn(&str) -> bool

fn is_empty(&self) -> bool

Returns whether this element matches :empty. Read more

fn is_root(&self) -> bool

Returns whether this element matches :root, i.e. whether it is the root element of a document. Read more

fn each_class<F>(&self, callback: F) where F: FnMut(&Atom)

fn insert_flags(&self, _flags: ElementFlags)

Add flags to the element. See the ElementFlags docs for details. Read more

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

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

fn eq(&self, __arg_0: &ElementRef<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &ElementRef<'a>) -> bool

This method tests for !=.

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

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

fn clone(&self) -> ElementRef<'a>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

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

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

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

type Target = NodeRef<'a, Node>

The resulting type after dereferencing

fn deref(&self) -> &NodeRef<'a, Node>

The method called to dereference a value