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]
impl<'a> ElementRef<'a>
pub fn wrap(node: NodeRef<'a, Node>) -> Option<Self>
[src]
pub fn wrap(node: NodeRef<'a, Node>) -> Option<Self>
Wraps a NodeRef
only if it references a Node::Element
.
pub fn value(&self) -> &'a Element
[src]
pub fn value(&self) -> &'a Element
Returns the Element
referenced by self
.
ⓘImportant traits for Select<'a, 'b>pub fn select<'b>(&self, selector: &'b Selector) -> Select<'a, 'b>
[src]
pub fn select<'b>(&self, selector: &'b Selector) -> Select<'a, 'b>
Returns an iterator over descendent elements matching a selector.
pub fn html(&self) -> String
[src]
pub fn html(&self) -> String
Returns the HTML of this element.
pub fn inner_html(&self) -> String
[src]
pub fn inner_html(&self) -> String
Returns the inner HTML of this element.
ⓘImportant traits for Text<'a>pub fn text(&self) -> Text<'a>
[src]
pub fn text(&self) -> Text<'a>
Returns an iterator over descendent text nodes.
Methods from Deref<Target = NodeRef<'a, Node>>
ⓘImportant traits for &'a mut Rpub fn value(&self) -> &'a T
[src]
pub fn value(&self) -> &'a T
Returns the value of this node.
pub fn parent(&self) -> Option<NodeRef<'a, T>>
[src]
pub fn parent(&self) -> Option<NodeRef<'a, T>>
Returns the parent of this node.
pub fn prev_sibling(&self) -> Option<NodeRef<'a, T>>
[src]
pub fn prev_sibling(&self) -> Option<NodeRef<'a, T>>
Returns the previous sibling of this node.
pub fn next_sibling(&self) -> Option<NodeRef<'a, T>>
[src]
pub fn next_sibling(&self) -> Option<NodeRef<'a, T>>
Returns the next sibling of this node.
pub fn first_child(&self) -> Option<NodeRef<'a, T>>
[src]
pub fn first_child(&self) -> Option<NodeRef<'a, T>>
Returns the first child of this node.
pub fn last_child(&self) -> Option<NodeRef<'a, T>>
[src]
pub fn last_child(&self) -> Option<NodeRef<'a, T>>
Returns the last child of this node.
pub fn has_siblings(&self) -> bool
[src]
pub fn has_siblings(&self) -> bool
Returns true if this node has siblings.
pub fn has_children(&self) -> bool
[src]
pub fn has_children(&self) -> bool
Returns true if this node has children.
ⓘImportant traits for Ancestors<'a, T>pub fn ancestors(&self) -> Ancestors<'a, T>
[src]
pub fn ancestors(&self) -> Ancestors<'a, T>
Returns an iterator over ancestors.
ⓘImportant traits for PrevSiblings<'a, T>pub fn prev_siblings(&self) -> PrevSiblings<'a, T>
[src]
pub fn prev_siblings(&self) -> PrevSiblings<'a, T>
Returns an iterator over previous siblings.
ⓘImportant traits for NextSiblings<'a, T>pub fn next_siblings(&self) -> NextSiblings<'a, T>
[src]
pub fn next_siblings(&self) -> NextSiblings<'a, T>
Returns an iterator over next siblings.
ⓘImportant traits for FirstChildren<'a, T>pub fn first_children(&self) -> FirstChildren<'a, T>
[src]
pub fn first_children(&self) -> FirstChildren<'a, T>
Returns an iterator over first children.
ⓘImportant traits for LastChildren<'a, T>pub fn last_children(&self) -> LastChildren<'a, T>
[src]
pub fn last_children(&self) -> LastChildren<'a, T>
Returns an iterator over last children.
ⓘImportant traits for Children<'a, T>pub fn children(&self) -> Children<'a, T>
[src]
pub fn children(&self) -> Children<'a, T>
Returns an iterator over children.
ⓘImportant traits for Traverse<'a, T>pub fn traverse(&self) -> Traverse<'a, T>
[src]
pub fn traverse(&self) -> Traverse<'a, T>
Returns an iterator which traverses the subtree starting at this node.
ⓘImportant traits for Descendants<'a, T>pub fn descendants(&self) -> Descendants<'a, T>
[src]
pub fn descendants(&self) -> Descendants<'a, T>
Returns an iterator over this node and its descendants.
Trait Implementations
impl<'a> Element for ElementRef<'a>
[src]
impl<'a> Element for ElementRef<'a>
Note: will never match against non-tree-structure pseudo-classes.
type Impl = Simple
fn parent_element(&self) -> Option<Self>
[src]
fn parent_element(&self) -> Option<Self>
fn first_child_element(&self) -> Option<Self>
[src]
fn first_child_element(&self) -> Option<Self>
Skips non-element nodes
fn last_child_element(&self) -> Option<Self>
[src]
fn last_child_element(&self) -> Option<Self>
Skips non-element nodes
fn prev_sibling_element(&self) -> Option<Self>
[src]
fn prev_sibling_element(&self) -> Option<Self>
Skips non-element nodes
fn next_sibling_element(&self) -> Option<Self>
[src]
fn next_sibling_element(&self) -> Option<Self>
Skips non-element nodes
fn is_html_element_in_html_document(&self) -> bool
[src]
fn is_html_element_in_html_document(&self) -> bool
fn get_local_name(&self) -> &LocalName
[src]
fn get_local_name(&self) -> &LocalName
fn get_namespace(&self) -> &Namespace
[src]
fn get_namespace(&self) -> &Namespace
Empty string for no namespace
fn match_non_ts_pseudo_class<F>(
&self,
_pc: &NonTSPseudoClass,
_context: &mut MatchingContext<Self::Impl>,
_visited_handling: VisitedHandlingMode,
_flags_setter: &mut F
) -> bool
[src]
fn match_non_ts_pseudo_class<F>(
&self,
_pc: &NonTSPseudoClass,
_context: &mut MatchingContext<Self::Impl>,
_visited_handling: VisitedHandlingMode,
_flags_setter: &mut F
) -> bool
fn has_class(&self, name: &LocalName, case_sensitivity: CaseSensitivity) -> bool
[src]
fn has_class(&self, name: &LocalName, case_sensitivity: CaseSensitivity) -> bool
fn is_empty(&self) -> bool
[src]
fn is_empty(&self) -> bool
Returns whether this element matches :empty
. Read more
fn is_root(&self) -> bool
[src]
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 attr_matches(
&self,
ns: &NamespaceConstraint<&Namespace>,
local_name: &LocalName,
operation: &AttrSelectorOperation<&String>
) -> bool
[src]
fn attr_matches(
&self,
ns: &NamespaceConstraint<&Namespace>,
local_name: &LocalName,
operation: &AttrSelectorOperation<&String>
) -> bool
fn match_pseudo_element(
&self,
_pe: &PseudoElement,
_context: &mut MatchingContext<Self::Impl>
) -> bool
[src]
fn match_pseudo_element(
&self,
_pe: &PseudoElement,
_context: &mut MatchingContext<Self::Impl>
) -> bool
fn is_link(&self) -> bool
[src]
fn is_link(&self) -> bool
Whether this element is a link
.
fn opaque(&self) -> OpaqueElement
[src]
fn opaque(&self) -> OpaqueElement
Converts self into an opaque representation.
fn has_id(&self, id: &LocalName, case_sensitivity: CaseSensitivity) -> bool
[src]
fn has_id(&self, id: &LocalName, case_sensitivity: CaseSensitivity) -> bool
fn pseudo_element_originating_element(&self) -> Option<Self>
[src]
fn pseudo_element_originating_element(&self) -> Option<Self>
The parent of a given pseudo-element, after matching a pseudo-element selector. Read more
fn assigned_slot(&self) -> Option<Self>
[src]
fn assigned_slot(&self) -> Option<Self>
Returns the assigned element this element is assigned to. Read more
fn ignores_nth_child_selectors(&self) -> bool
[src]
fn ignores_nth_child_selectors(&self) -> bool
Returns whether this element should ignore matching nth child selector. Read more
fn blocks_ancestor_combinators(&self) -> bool
[src]
fn blocks_ancestor_combinators(&self) -> bool
Return true if we want to stop lookup ancestor of the current element while matching complex selectors with descendant/child combinator. Read more
impl<'a> Serialize for ElementRef<'a>
[src]
impl<'a> Serialize for ElementRef<'a>
fn serialize<S: Serializer>(
&self,
serializer: &mut S,
traversal_scope: TraversalScope
) -> Result<(), Error>
[src]
fn serialize<S: Serializer>(
&self,
serializer: &mut S,
traversal_scope: TraversalScope
) -> Result<(), Error>
Take the serializer and call its methods to serialize this type. The type will dictate which methods are called and with what parameters. Read more
impl<'a> Debug for ElementRef<'a>
[src]
impl<'a> Debug for ElementRef<'a>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a> Clone for ElementRef<'a>
[src]
impl<'a> Clone for ElementRef<'a>
fn clone(&self) -> 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[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<'a> Copy for ElementRef<'a>
[src]
impl<'a> Copy for ElementRef<'a>
impl<'a> PartialEq for ElementRef<'a>
[src]
impl<'a> PartialEq for ElementRef<'a>
fn eq(&self, other: &ElementRef<'a>) -> bool
[src]
fn eq(&self, other: &ElementRef<'a>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &ElementRef<'a>) -> bool
[src]
fn ne(&self, other: &ElementRef<'a>) -> bool
This method tests for !=
.
impl<'a> Eq for ElementRef<'a>
[src]
impl<'a> Eq for ElementRef<'a>
impl<'a> Deref for ElementRef<'a>
[src]
impl<'a> Deref for ElementRef<'a>
Auto Trait Implementations
impl<'a> !Send for ElementRef<'a>
impl<'a> !Send for ElementRef<'a>
impl<'a> !Sync for ElementRef<'a>
impl<'a> !Sync for ElementRef<'a>