pub struct NodeHierarchyRef<'a> {
pub internal: &'a [Node],
}Expand description
The hierarchy of nodes is stored separately from the actual node content in order to save on memory, since the hierarchy can be re-used across several DOM trees even if the content changes.
Fields§
§internal: &'a [Node]Implementations§
Source§impl<'a> NodeHierarchyRef<'a>
impl<'a> NodeHierarchyRef<'a>
pub fn from_slice(data: &'a [Node]) -> NodeHierarchyRef<'a>
pub fn len(&self) -> usize
pub fn get(&self, id: NodeId) -> Option<&Node>
pub fn linear_iter(&self) -> LinearIterator ⓘ
Sourcepub fn get_parents_sorted_by_depth(&self) -> NodeDepths
pub fn get_parents_sorted_by_depth(&self) -> NodeDepths
Returns the (depth, NodeId) of all parent nodes (i.e. nodes that have a
first_child), in depth sorted order, (i.e. NodeId(0) with a depth of 0) is
the first element.
Runtime: O(n) max
Trait Implementations§
Source§impl<'a> Debug for NodeHierarchyRef<'a>
impl<'a> Debug for NodeHierarchyRef<'a>
Source§impl<'a> Hash for NodeHierarchyRef<'a>
impl<'a> Hash for NodeHierarchyRef<'a>
Source§impl<'a> Index<NodeId> for NodeHierarchyRef<'a>
impl<'a> Index<NodeId> for NodeHierarchyRef<'a>
Source§impl<'a> PartialEq for NodeHierarchyRef<'a>
impl<'a> PartialEq for NodeHierarchyRef<'a>
Source§fn eq(&self, other: &NodeHierarchyRef<'a>) -> bool
fn eq(&self, other: &NodeHierarchyRef<'a>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<'a> Eq for NodeHierarchyRef<'a>
impl<'a> StructuralPartialEq for NodeHierarchyRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for NodeHierarchyRef<'a>
impl<'a> RefUnwindSafe for NodeHierarchyRef<'a>
impl<'a> Send for NodeHierarchyRef<'a>
impl<'a> Sync for NodeHierarchyRef<'a>
impl<'a> Unpin for NodeHierarchyRef<'a>
impl<'a> UnsafeUnpin for NodeHierarchyRef<'a>
impl<'a> UnwindSafe for NodeHierarchyRef<'a>
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
Mutably borrows from an owned value. Read more