pub struct SelectorMap { /* private fields */ }Expand description
Map of element indices to their selectors Uses IndexMap to preserve insertion order
Implementations§
Source§impl SelectorMap
impl SelectorMap
Sourcepub fn register(&mut self, selector: ElementSelector) -> usize
pub fn register(&mut self, selector: ElementSelector) -> usize
Register a new element and return its assigned index
Sourcepub fn get(&self, index: usize) -> Option<&ElementSelector>
pub fn get(&self, index: usize) -> Option<&ElementSelector>
Get selector by index
Sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut ElementSelector>
pub fn get_mut(&mut self, index: usize) -> Option<&mut ElementSelector>
Get mutable selector by index
Sourcepub fn remove(&mut self, index: usize) -> Option<ElementSelector>
pub fn remove(&mut self, index: usize) -> Option<ElementSelector>
Remove an element by index
Sourcepub fn iter(&self) -> impl Iterator<Item = (&usize, &ElementSelector)>
pub fn iter(&self) -> impl Iterator<Item = (&usize, &ElementSelector)>
Iterate over all (index, selector) pairs
Sourcepub fn selectors(&self) -> impl Iterator<Item = &ElementSelector>
pub fn selectors(&self) -> impl Iterator<Item = &ElementSelector>
Get all selectors
Sourcepub fn find_by_css_selector(&self, css_selector: &str) -> Option<usize>
pub fn find_by_css_selector(&self, css_selector: &str) -> Option<usize>
Find index by CSS selector
Sourcepub fn find_by_id(&self, id: &str) -> Option<usize>
pub fn find_by_id(&self, id: &str) -> Option<usize>
Find index by element ID
Trait Implementations§
Source§impl Clone for SelectorMap
impl Clone for SelectorMap
Source§fn clone(&self) -> SelectorMap
fn clone(&self) -> SelectorMap
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 SelectorMap
impl Debug for SelectorMap
Source§impl Default for SelectorMap
impl Default for SelectorMap
Source§fn default() -> SelectorMap
fn default() -> SelectorMap
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SelectorMap
impl RefUnwindSafe for SelectorMap
impl Send for SelectorMap
impl Sync for SelectorMap
impl Unpin for SelectorMap
impl UnwindSafe for SelectorMap
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