kuchiki

Struct NodeDataRef

source
pub struct NodeDataRef<T> { /* private fields */ }
Expand description

Holds a strong reference to a node, but dereferences to some component inside of it.

Implementations§

source§

impl<T> NodeDataRef<T>

source

pub fn new<F>(rc: NodeRef, f: F) -> NodeDataRef<T>
where F: FnOnce(&Node) -> &T,

Create a NodeDataRef for a component in a given node.

source

pub fn new_opt<F>(rc: NodeRef, f: F) -> Option<NodeDataRef<T>>
where F: FnOnce(&Node) -> Option<&T>,

Create a NodeDataRef for and a component that may or may not be in a given node.

source

pub fn as_node(&self) -> &NodeRef

Access the corresponding node.

source§

impl NodeDataRef<ElementData>

source

pub fn text_contents(&self) -> String

Return the concatenation of all text nodes in this subtree.

Trait Implementations§

source§

impl<T> Clone for NodeDataRef<T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for NodeDataRef<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<T> Deref for NodeDataRef<T>

source§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &T

Dereferences the value.
source§

impl Element for NodeDataRef<ElementData>

source§

type Impl = KuchikiSelectors

source§

fn opaque(&self) -> OpaqueElement

Converts self into an opaque representation.
source§

fn is_html_slot_element(&self) -> bool

Returns whether the element is an HTML element.
source§

fn parent_node_is_shadow_root(&self) -> bool

Whether the parent node of this element is a shadow root.
source§

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

The host of the containing shadow root, if any.
source§

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

source§

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

Skips non-element nodes
source§

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

Skips non-element nodes
source§

fn is_empty(&self) -> bool

Returns whether this element matches :empty. Read more
source§

fn is_root(&self) -> bool

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

fn is_html_element_in_html_document(&self) -> bool

source§

fn has_local_name(&self, name: &LocalName) -> bool

source§

fn has_namespace(&self, namespace: &Namespace) -> bool

Empty string for no namespace
source§

fn is_part(&self, _name: &LocalName) -> bool

source§

fn exported_part(&self, _: &LocalName) -> Option<LocalName>

Returns the mapping from the exportparts attribute in the regular direction, that is, inner-tree -> outer-tree.
source§

fn imported_part(&self, _: &LocalName) -> Option<LocalName>

Returns the mapping from the exportparts attribute in the reverse direction, that is, in an outer-tree -> inner-tree direction.
source§

fn is_pseudo_element(&self) -> bool

Whether we’re matching on a pseudo-element.
source§

fn is_same_type(&self, other: &Self) -> bool

Whether this element and the other element have the same local name and namespace.
Whether this element is a link.
source§

fn has_id(&self, id: &LocalName, case_sensitivity: CaseSensitivity) -> bool

source§

fn has_class(&self, name: &LocalName, case_sensitivity: CaseSensitivity) -> bool

source§

fn attr_matches( &self, ns: &NamespaceConstraint<&Namespace>, local_name: &LocalName, operation: &AttrSelectorOperation<&String>, ) -> bool

source§

fn match_pseudo_element( &self, pseudo: &PseudoElement, _context: &mut MatchingContext<'_, KuchikiSelectors>, ) -> bool

source§

fn match_non_ts_pseudo_class<F>( &self, pseudo: &PseudoClass, _context: &mut MatchingContext<'_, KuchikiSelectors>, _flags_setter: &mut F, ) -> bool
where F: FnMut(&Self, ElementSelectorFlags),

source§

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

The parent of a given pseudo-element, after matching a pseudo-element selector. Read more
source§

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

Returns the assigned element this element is assigned to. Read more
source§

fn ignores_nth_child_selectors(&self) -> bool

Returns whether this element should ignore matching nth child selector.
source§

impl<T> PartialEq for NodeDataRef<T>

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Eq> Eq for NodeDataRef<T>

Auto Trait Implementations§

§

impl<T> Freeze for NodeDataRef<T>

§

impl<T> !RefUnwindSafe for NodeDataRef<T>

§

impl<T> !Send for NodeDataRef<T>

§

impl<T> !Sync for NodeDataRef<T>

§

impl<T> Unpin for NodeDataRef<T>

§

impl<T> !UnwindSafe for NodeDataRef<T>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.