selectors::parser

Trait SelectorImpl

Source
pub trait SelectorImpl:
    Clone
    + Debug
    + Sized
    + 'static {
    type ExtraMatchingData<'a>: Sized + Default;
    type AttrValue: Clone + Eq + for<'a> From<&'a str> + ToCss;
    type Identifier: Clone + Eq + for<'a> From<&'a str> + ToCss;
    type LocalName: Clone + Eq + for<'a> From<&'a str> + ToCss + Borrow<Self::BorrowedLocalName>;
    type NamespaceUrl: Clone + Eq + Default + Borrow<Self::BorrowedNamespaceUrl>;
    type NamespacePrefix: Clone + Eq + for<'a> From<&'a str> + ToCss + Default;
    type BorrowedNamespaceUrl: ?Sized + Eq;
    type BorrowedLocalName: ?Sized + Eq;
    type NonTSPseudoClass: Clone + Eq + NonTSPseudoClass<Impl = Self>;
    type PseudoElement: Clone + Eq + PseudoElement<Impl = Self>;

    // Provided method
    fn should_collect_attr_hash(_name: &Self::LocalName) -> bool { ... }
}
Expand description

This trait allows to define the parser implementation in regards of pseudo-classes/elements

NB: We need Clone so that we can derive(Clone) on struct with that are parameterized on SelectorImpl. See https://github.com/rust-lang/rust/issues/26925

Required Associated Types§

Source

type ExtraMatchingData<'a>: Sized + Default

Source

type AttrValue: Clone + Eq + for<'a> From<&'a str> + ToCss

Source

type Identifier: Clone + Eq + for<'a> From<&'a str> + ToCss

Source

type LocalName: Clone + Eq + for<'a> From<&'a str> + ToCss + Borrow<Self::BorrowedLocalName>

Source

type NamespaceUrl: Clone + Eq + Default + Borrow<Self::BorrowedNamespaceUrl>

Source

type NamespacePrefix: Clone + Eq + for<'a> From<&'a str> + ToCss + Default

Source

type BorrowedNamespaceUrl: ?Sized + Eq

Source

type BorrowedLocalName: ?Sized + Eq

Source

type NonTSPseudoClass: Clone + Eq + NonTSPseudoClass<Impl = Self>

non tree-structural pseudo-classes (see: https://drafts.csswg.org/selectors/#structural-pseudos)

Source

type PseudoElement: Clone + Eq + PseudoElement<Impl = Self>

pseudo-elements

Provided Methods§

Source

fn should_collect_attr_hash(_name: &Self::LocalName) -> bool

Whether attribute hashes should be collected for filtering purposes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§