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>
Core methods for NodeDataRef.
impl<T> NodeDataRef<T>
Core methods for NodeDataRef.
Provides construction and access methods for typed references to node data.
Sourcepub fn new<F>(rc: NodeRef, f: F) -> NodeDataRef<T>
pub fn new<F>(rc: NodeRef, f: F) -> NodeDataRef<T>
Create a NodeDataRef for a component in a given node.
Sourcepub fn new_opt<F>(rc: NodeRef, f: F) -> Option<NodeDataRef<T>>
pub fn new_opt<F>(rc: NodeRef, f: F) -> Option<NodeDataRef<T>>
Create a NodeDataRef for and a component that may or may not be in a given node.
Source§impl NodeDataRef<ElementData>
Element-specific methods for NodeDataRef.
impl NodeDataRef<ElementData>
Element-specific methods for NodeDataRef
Provides convenience methods for working with element nodes.
Sourcepub fn text_contents(&self) -> String
pub fn text_contents(&self) -> String
Return the concatenation of all text nodes in this subtree.
Sourcepub fn local_name(&self) -> &LocalName
pub fn local_name(&self) -> &LocalName
Returns the local name of the element without any namespace prefix.
§Examples
use brik::parse_html;
use brik::traits::*;
let doc = parse_html().one("<div>Hello</div>");
let div = doc.select_first("div").unwrap();
assert_eq!(div.local_name().as_ref(), "div");Trait Implementations§
Source§impl<T> Clone for NodeDataRef<T>
Implements Clone for NodeDataRef.
impl<T> Clone for NodeDataRef<T>
Implements Clone for NodeDataRef.
Clones the NodeDataRef by cloning the underlying NodeRef and copying the type information. Avoids requiring T: Clone.
Source§impl<T: Debug> Debug for NodeDataRef<T>
Available on non-crate feature safe only.Implements Debug for NodeDataRef (unsafe mode).
impl<T: Debug> Debug for NodeDataRef<T>
safe only.Implements Debug for NodeDataRef (unsafe mode).
Formats the referenced data for debugging using the data’s Debug impl.
Source§impl<T> Deref for NodeDataRef<T>
Available on non-crate feature safe only.Implements Deref for NodeDataRef (unsafe mode).
impl<T> Deref for NodeDataRef<T>
safe only.Implements Deref for NodeDataRef (unsafe mode).
Allows transparent access to the underlying node data using unsafe pointer dereferencing for performance.
Source§impl Element for NodeDataRef<ElementData>
Implements selectors::Element for NodeDataRef.
impl Element for NodeDataRef<ElementData>
Implements selectors::Element for NodeDataRef
Provides the selectors crate interface for CSS selector matching on Brik’s ElementData nodes. This implementation enables full CSS selector support including element relationships, attributes, pseudo-classes, and namespace matching.
type Impl = BrikSelectors
Source§fn opaque(&self) -> OpaqueElement
fn opaque(&self) -> OpaqueElement
Source§fn is_html_slot_element(&self) -> bool
fn is_html_slot_element(&self) -> bool
Source§fn parent_node_is_shadow_root(&self) -> bool
fn parent_node_is_shadow_root(&self) -> bool
Source§fn containing_shadow_host(&self) -> Option<Self>
fn containing_shadow_host(&self) -> Option<Self>
fn parent_element(&self) -> Option<Self>
Source§fn prev_sibling_element(&self) -> Option<Self>
fn prev_sibling_element(&self) -> Option<Self>
Source§fn next_sibling_element(&self) -> Option<Self>
fn next_sibling_element(&self) -> Option<Self>
Source§fn first_element_child(&self) -> Option<Self>
fn first_element_child(&self) -> Option<Self>
Source§fn is_root(&self) -> bool
fn is_root(&self) -> bool
:root,
i.e. whether it is the root element of a document. Read morefn is_html_element_in_html_document(&self) -> bool
fn has_local_name(&self, name: &LocalName) -> bool
Source§fn has_namespace(&self, namespace: &Namespace) -> bool
fn has_namespace(&self, namespace: &Namespace) -> bool
fn is_part(&self, _name: &LocalNameSelector) -> bool
Source§fn imported_part(&self, _: &LocalNameSelector) -> Option<LocalNameSelector>
fn imported_part(&self, _: &LocalNameSelector) -> Option<LocalNameSelector>
exportparts attribute in the reverse
direction, that is, in an outer-tree -> inner-tree direction.Source§fn is_pseudo_element(&self) -> bool
fn is_pseudo_element(&self) -> bool
Source§fn is_same_type(&self, other: &Self) -> bool
fn is_same_type(&self, other: &Self) -> bool
other element have the same local name and namespace.fn has_id( &self, id: &LocalNameSelector, case_sensitivity: CaseSensitivity, ) -> bool
fn has_class( &self, name: &LocalNameSelector, case_sensitivity: CaseSensitivity, ) -> bool
fn attr_matches( &self, ns: &NamespaceConstraint<&Namespace>, local_name: &LocalNameSelector, operation: &AttrSelectorOperation<&AttrValue>, ) -> bool
fn match_pseudo_element( &self, pseudo: &PseudoElement, _context: &mut MatchingContext<'_, BrikSelectors>, ) -> bool
fn match_non_ts_pseudo_class( &self, pseudo: &PseudoClass, _context: &mut MatchingContext<'_, BrikSelectors>, ) -> bool
Source§fn apply_selector_flags(&self, _flags: ElementSelectorFlags)
fn apply_selector_flags(&self, _flags: ElementSelectorFlags)
fn has_custom_state(&self, _name: &LocalNameSelector) -> bool
Source§fn add_element_unique_hashes(&self, filter: &mut BloomFilter) -> bool
fn add_element_unique_hashes(&self, filter: &mut BloomFilter) -> bool
Source§fn pseudo_element_originating_element(&self) -> Option<Self>
fn pseudo_element_originating_element(&self) -> Option<Self>
fn has_attr_in_no_namespace( &self, local_name: &<Self::Impl as SelectorImpl>::LocalName, ) -> bool
Source§fn assigned_slot(&self) -> Option<Self>
fn assigned_slot(&self) -> Option<Self>
Source§fn ignores_nth_child_selectors(&self) -> bool
fn ignores_nth_child_selectors(&self) -> bool
Source§impl<T> PartialEq for NodeDataRef<T>
Implements PartialEq for NodeDataRef.
impl<T> PartialEq for NodeDataRef<T>
Implements PartialEq for NodeDataRef.
Compares NodeDataRef instances by comparing their underlying NodeRef, not the type parameter T. This avoids requiring T: PartialEq.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.