pub struct SelectorPart {
pub element: Option<String>,
pub id: Option<String>,
pub classes: Vec<String>,
pub attributes: Vec<AttributeSelector>,
pub pseudo_classes: Vec<PseudoClass>,
pub universal: bool,
}Expand description
A single selector part (between combinators)
Fields§
§element: Option<String>Type/element name (None = universal)
id: Option<String>ID selector
classes: Vec<String>Class selectors
attributes: Vec<AttributeSelector>Attribute selectors
pseudo_classes: Vec<PseudoClass>Pseudo-classes
universal: boolUniversal selector (*)
Implementations§
Source§impl SelectorPart
impl SelectorPart
Sourcepub fn with_class(self, class: impl Into<String>) -> Self
pub fn with_class(self, class: impl Into<String>) -> Self
Add a class
Sourcepub fn with_pseudo(self, pseudo: PseudoClass) -> Self
pub fn with_pseudo(self, pseudo: PseudoClass) -> Self
Add a pseudo-class
Sourcepub fn specificity(&self) -> (usize, usize, usize)
pub fn specificity(&self) -> (usize, usize, usize)
Calculate specificity (a, b, c)
- a: ID selectors
- b: class selectors, attribute selectors, pseudo-classes
- c: type selectors, pseudo-elements
Trait Implementations§
Source§impl Clone for SelectorPart
impl Clone for SelectorPart
Source§fn clone(&self) -> SelectorPart
fn clone(&self) -> SelectorPart
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 SelectorPart
impl Debug for SelectorPart
Source§impl Default for SelectorPart
impl Default for SelectorPart
Source§fn default() -> SelectorPart
fn default() -> SelectorPart
Returns the “default value” for a type. Read more
Source§impl Display for SelectorPart
impl Display for SelectorPart
Source§impl PartialEq for SelectorPart
impl PartialEq for SelectorPart
impl Eq for SelectorPart
impl StructuralPartialEq for SelectorPart
Auto Trait Implementations§
impl Freeze for SelectorPart
impl RefUnwindSafe for SelectorPart
impl Send for SelectorPart
impl Sync for SelectorPart
impl Unpin for SelectorPart
impl UnsafeUnpin for SelectorPart
impl UnwindSafe for SelectorPart
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