Struct scraper::element_ref::ElementRef
[−]
[src]
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]
fn wrap(node: NodeRef<'a, Node>) -> Option<Self>
[src]
Wraps a NodeRef
only if it references a Node::Element
.
fn value(&self) -> &'a Element
[src]
Returns the Element
referenced by self
.
fn select<'b>(&self, selector: &'b Selector) -> Select<'a, 'b>
[src]
Returns an iterator over descendent elements matching a selector.
fn html(&self) -> String
[src]
Returns the HTML of this element.
fn inner_html(&self) -> String
[src]
Returns the inner HTML of this element.
fn text(&self) -> Text<'a>
[src]
Returns an iterator over descendent text nodes.
Methods from Deref<Target = NodeRef<'a, Node>>
fn value(&self) -> &'a T
[src]
Returns the value of this node.
fn id(&self) -> NodeId<T>
[src]
Returns the ID of this node.
fn parent(&self) -> Option<NodeRef<'a, T>>
[src]
Returns a reference to this node's parent.
fn prev_sibling(&self) -> Option<NodeRef<'a, T>>
[src]
Returns a reference to this node's previous sibling.
fn next_sibling(&self) -> Option<NodeRef<'a, T>>
[src]
Returns a reference to this node's next sibling.
fn first_child(&self) -> Option<NodeRef<'a, T>>
[src]
Returns a reference to this node's first child.
fn last_child(&self) -> Option<NodeRef<'a, T>>
[src]
Returns a reference to this node's last child.
fn has_siblings(&self) -> bool
[src]
Returns true if this node has siblings.
fn has_children(&self) -> bool
[src]
Returns true if this node has children.
fn ancestors(&self) -> Ancestors<'a, T>
[src]
Returns an iterator over this node's ancestors.
fn prev_siblings(&self) -> PrevSiblings<'a, T>
[src]
Returns an iterator over this node's previous siblings.
fn next_siblings(&self) -> NextSiblings<'a, T>
[src]
Returns an iterator over this node's next siblings.
fn children(&self) -> Children<'a, T>
[src]
Returns an iterator over this node's children.
fn first_children(&self) -> FirstChildren<'a, T>
[src]
Returns an iterator over this node's first children.
fn last_children(&self) -> LastChildren<'a, T>
[src]
Returns an iterator over this node's last children.
fn traverse(&self) -> Traverse<'a, T>
[src]
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>
[src]
fn first_child_element(&self) -> Option<Self>
[src]
Skips non-element nodes
fn last_child_element(&self) -> Option<Self>
[src]
Skips non-element nodes
fn prev_sibling_element(&self) -> Option<Self>
[src]
Skips non-element nodes
fn next_sibling_element(&self) -> Option<Self>
[src]
Skips non-element nodes
fn is_html_element_in_html_document(&self) -> bool
[src]
fn get_local_name(&self) -> &LocalName
[src]
fn get_namespace(&self) -> &Namespace
[src]
Empty string for no namespace
fn match_non_ts_pseudo_class<F>(
&self,
_pc: &NonTSPseudoClass,
_context: &mut MatchingContext,
_flags_setter: &mut F
) -> bool
[src]
&self,
_pc: &NonTSPseudoClass,
_context: &mut MatchingContext,
_flags_setter: &mut F
) -> bool
fn get_id(&self) -> Option<LocalName>
[src]
fn has_class(&self, name: &LocalName) -> bool
[src]
fn is_empty(&self) -> bool
[src]
Returns whether this element matches :empty
. Read more
fn is_root(&self) -> bool
[src]
Returns whether this element matches :root
, i.e. whether it is the root element of a document. Read more
fn attr_matches(
&self,
ns: &NamespaceConstraint<&Namespace>,
local_name: &LocalName,
operation: &AttrSelectorOperation<&String>
) -> bool
[src]
&self,
ns: &NamespaceConstraint<&Namespace>,
local_name: &LocalName,
operation: &AttrSelectorOperation<&String>
) -> bool
fn match_pseudo_element(
&self,
_pe: &PseudoElement,
_context: &mut MatchingContext
) -> bool
[src]
&self,
_pe: &PseudoElement,
_context: &mut MatchingContext
) -> bool
fn pseudo_element_originating_element(&self) -> Option<Self>
[src]
The parent of a given pseudo-element, after matching a pseudo-element selector. Read more
impl<'a> Serialize for ElementRef<'a>
[src]
fn serialize<S: Serializer>(
&self,
serializer: &mut S,
traversal_scope: TraversalScope
) -> Result<(), Error>
[src]
&self,
serializer: &mut S,
traversal_scope: TraversalScope
) -> Result<(), Error>
impl<'a> Debug for ElementRef<'a>
[src]
impl<'a> Clone for ElementRef<'a>
[src]
fn clone(&self) -> ElementRef<'a>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> Copy for ElementRef<'a>
[src]
impl<'a> PartialEq for ElementRef<'a>
[src]
fn eq(&self, __arg_0: &ElementRef<'a>) -> bool
[src]
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
[src]
This method tests for !=
.