Expand description
Wrapper around CSS selectors.
Represents a “selector group”, i.e. a comma-separated list of selectors.
Fields
selectors: SmallVec<[Selector<Simple>; 1]>The CSS selectors.
Implementations
sourceimpl Selector
impl Selector
sourcepub fn parse(
selectors: &str
) -> Result<Self, ParseError<'_, SelectorParseErrorKind<'_>>>
pub fn parse(
selectors: &str
) -> Result<Self, ParseError<'_, SelectorParseErrorKind<'_>>>
Parses a CSS selector group.
sourcepub fn matches(&self, element: &ElementRef<'_>) -> bool
pub fn matches(&self, element: &ElementRef<'_>) -> bool
Returns true if the element matches this selector.
sourcepub fn matches_with_scope(
&self,
element: &ElementRef<'_>,
scope: Option<ElementRef<'_>>
) -> bool
pub fn matches_with_scope(
&self,
element: &ElementRef<'_>,
scope: Option<ElementRef<'_>>
) -> bool
Returns true if the element matches this selector.
The optional scope argument is used to specify which element has :scope pseudo-class.
When it is None, :scope will match the root element.
Trait Implementations
sourceimpl<'i> TryFrom<&'i str> for Selector
impl<'i> TryFrom<&'i str> for Selector
type Error = ParseError<'i, SelectorParseErrorKind<'i>>
type Error = ParseError<'i, SelectorParseErrorKind<'i>>
The type returned in the event of a conversion error.
impl StructuralPartialEq for Selector
Auto Trait Implementations
impl RefUnwindSafe for Selector
impl Send for Selector
impl Sync for Selector
impl Unpin for Selector
impl UnwindSafe for Selector
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more