[−][src]Struct scraper::element_ref::ElementRef
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]
fn clone(&self) -> ElementRef<'a>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[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.
fn deref(&self) -> &NodeRef<'a, Node>
[src]
impl<'a> Element for ElementRef<'a>
[src]
Note: will never match against non-tree-structure pseudo-classes.
type Impl = Simple
fn opaque(&self) -> OpaqueElement
[src]
fn parent_element(&self) -> Option<Self>
[src]
fn parent_node_is_shadow_root(&self) -> bool
[src]
fn containing_shadow_host(&self) -> Option<Self>
[src]
fn is_pseudo_element(&self) -> bool
[src]
fn is_part(&self, _name: &LocalName) -> bool
[src]
fn is_same_type(&self, other: &Self) -> bool
[src]
fn exported_part(&self, _: &LocalName) -> Option<LocalName>
[src]
fn imported_part(&self, _: &LocalName) -> Option<LocalName>
[src]
fn prev_sibling_element(&self) -> Option<Self>
[src]
fn next_sibling_element(&self) -> Option<Self>
[src]
fn is_html_element_in_html_document(&self) -> bool
[src]
fn has_local_name(&self, name: &LocalName) -> bool
[src]
fn has_namespace(&self, namespace: &Namespace) -> bool
[src]
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_non_ts_pseudo_class<F>(
&self,
_pc: &NonTSPseudoClass,
_context: &mut MatchingContext<Self::Impl>,
_flags_setter: &mut F
) -> bool
[src]
&self,
_pc: &NonTSPseudoClass,
_context: &mut MatchingContext<Self::Impl>,
_flags_setter: &mut F
) -> bool
fn match_pseudo_element(
&self,
_pe: &PseudoElement,
_context: &mut MatchingContext<Self::Impl>
) -> bool
[src]
&self,
_pe: &PseudoElement,
_context: &mut MatchingContext<Self::Impl>
) -> bool
fn is_link(&self) -> bool
[src]
fn is_html_slot_element(&self) -> bool
[src]
fn has_id(&self, id: &LocalName, case_sensitivity: CaseSensitivity) -> bool
[src]
fn has_class(&self, name: &LocalName, case_sensitivity: CaseSensitivity) -> bool
[src]
fn is_empty(&self) -> bool
[src]
fn is_root(&self) -> bool
[src]
fn pseudo_element_originating_element(&self) -> Option<Self>
[src]
fn assigned_slot(&self) -> Option<Self>
[src]
fn ignores_nth_child_selectors(&self) -> bool
[src]
impl<'a> Eq for ElementRef<'a>
[src]
impl<'a> PartialEq<ElementRef<'a>> for ElementRef<'a>
[src]
fn eq(&self, other: &ElementRef<'a>) -> bool
[src]
fn ne(&self, other: &ElementRef<'a>) -> bool
[src]
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> 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]
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>,