pub struct Selector<'a> {
components: Vec<Component<'a>>,
}
Expand description
A selector.
Fields§
§components: Vec<Component<'a>>
Implementations§
Source§impl<'a> Selector<'a>
impl<'a> Selector<'a>
Sourcepub fn parse(text: &'a str) -> Option<Self>
pub fn parse(text: &'a str) -> Option<Self>
Parses a selector from a string.
Will log any errors as a warnings.
Parsing will be stopped at EOF, ,
or {
.
Sourcepub fn specificity(&self) -> [u8; 3]
pub fn specificity(&self) -> [u8; 3]
Compute the selector’s specificity.
Sourcepub fn matches<E: Element>(&self, element: &E) -> bool
pub fn matches<E: Element>(&self, element: &E) -> bool
Checks that the provided element matches the current selector.
fn matches_impl<E: Element>(&self, idx: usize, element: &E) -> bool
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Selector<'a>
impl<'a> RefUnwindSafe for Selector<'a>
impl<'a> Send for Selector<'a>
impl<'a> Sync for Selector<'a>
impl<'a> Unpin for Selector<'a>
impl<'a> UnwindSafe for Selector<'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