pub struct DocumentIndex { /* private fields */ }Expand description
Index for fast element lookup by ID and class.
Implementations§
Source§impl DocumentIndex
impl DocumentIndex
Sourcepub fn register_id(&mut self, id: String, node_id: NodeId)
pub fn register_id(&mut self, id: String, node_id: NodeId)
Registers an element’s ID.
Per HTML spec, first occurrence wins if duplicate IDs exist.
Sourcepub fn register_classes(&mut self, classes: &str, node_id: NodeId)
pub fn register_classes(&mut self, classes: &str, node_id: NodeId)
Registers an element’s classes.
Sourcepub fn get_by_class(&self, class: &str) -> &[NodeId]
pub fn get_by_class(&self, class: &str) -> &[NodeId]
Looks up elements by class.
Sourcepub fn class_count(&self) -> usize
pub fn class_count(&self) -> usize
Returns the number of indexed classes.
Trait Implementations§
Source§impl Clone for DocumentIndex
impl Clone for DocumentIndex
Source§fn clone(&self) -> DocumentIndex
fn clone(&self) -> DocumentIndex
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DocumentIndex
impl Debug for DocumentIndex
Source§impl Default for DocumentIndex
impl Default for DocumentIndex
Source§fn default() -> DocumentIndex
fn default() -> DocumentIndex
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DocumentIndex
impl RefUnwindSafe for DocumentIndex
impl Send for DocumentIndex
impl Sync for DocumentIndex
impl Unpin 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