pub struct DocumentIndex { /* private fields */ }Expand description
Pre-built index for O(1) id, class, and tag lookups.
Build once with a single DFS pass, reuse for many lookups.
Implementations§
Source§impl DocumentIndex
impl DocumentIndex
Sourcepub fn build(doc: &Document) -> Self
pub fn build(doc: &Document) -> Self
Build an index from a document by scanning all nodes in a single pass.
If the arena has a pre-built tag index (constructed inline during tree building), the tag map is copied directly — avoiding the tag scan.
Sourcepub fn find_by_id<'a>(&self, doc: &'a Document, id: &str) -> Option<NodeRef<'a>>
pub fn find_by_id<'a>(&self, doc: &'a Document, id: &str) -> Option<NodeRef<'a>>
Look up a node by its id attribute in O(1).
Auto Trait Implementations§
impl Freeze for DocumentIndex
impl RefUnwindSafe for DocumentIndex
impl Send for DocumentIndex
impl Sync for DocumentIndex
impl Unpin for DocumentIndex
impl UnsafeUnpin for DocumentIndex
impl UnwindSafe for DocumentIndex
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