Module parser

Source

Re-exportsΒ§

pub use crate::visitor::SelectorVisitor;

MacrosΒ§

with_all_bounds πŸ”’
with_bounds πŸ”’

StructsΒ§

AnPlusB
The properties that comprise an An+B syntax
AncestorHashes
Ancestor hashes for the bloom filter. We precompute these and store them inline with selectors to optimize cache performance during matching. This matters a lot.
AncestorIter πŸ”’
An iterator over all simple selectors belonging to ancestors.
CombinatorComposition πŸ”’
Composition of combinators in a given selector, not traversing selectors of pseudoclasses.
CombinatorIter πŸ”’
An iterator over all combinators in a selector. Does not traverse selectors within psuedoclasses.
LocalName
NthOfSelectorData
The properties that comprise an :nth- pseudoclass as of Selectors 4 (e.g., nth-child(An+B [of S]?)). https://www.w3.org/TR/selectors-4/#nth-child-pseudo
NthSelectorData
The properties that comprise an :nth- pseudoclass as of Selectors 3 (e.g., nth-child(An+B)). https://www.w3.org/TR/selectors-3/#nth-child-pseudo
RelativeSelector
Storage for a relative selector.
RelativeSelectorCombinatorCount
Count of combinators in a given relative selector, not traversing selectors of pseudoclasses.
Selector
A Selector stores a sequence of simple selectors and combinators. The iterator classes allow callers to iterate at either the raw sequence level or at the level of sequences of simple selectors separated by combinators. Most callers want the higher-level iterator.
SelectorIter
SelectorKey
Uniquely identify a selector based on its components, which is behind ThinArc and is therefore stable.
SelectorList
A selector list is a tagged pointer with either a single selector, or a ThinArc<()> of multiple selectors.
SelectorParsingState πŸ”’
Flags that indicate at which point of parsing a selector are we.

EnumsΒ§

AttributeFlags πŸ”’
An attribute selector can have β€˜s’ or β€˜i’ as flags, or no flags at all.
Combinator
Component
A CSS simple selector or combinator. We store both in the same enum for optimal packing and cache performance, see [1].
ForgivingParsing πŸ”’
Whether or not we’re using forgiving parsing mode
MatchesFeaturelessHost
Whether a selector may match a featureless host element, and whether it may match other elements.
NthType
An enum for the different types of :nth- pseudoclasses
OptionalQName πŸ”’
ParseRelative
Flag indicating if we’re parsing relative selectors.
QNamePrefix πŸ”’
RelativeSelectorMatchHint
Flag indicating where a given relative selector’s match would be contained.
SelectorParseErrorKind
SimpleSelectorParseResult πŸ”’

TraitsΒ§

NonTSPseudoClass
A trait that represents a pseudo-class.
Parser
PseudoElement
A trait that represents a pseudo-element.
SelectorImpl
This trait allows to define the parser implementation in regards of pseudo-classes/elements

FunctionsΒ§

collect_ancestor_hashes πŸ”’
collect_selector_hashes πŸ”’
is_css2_pseudo_element
Returns whether the name corresponds to a CSS2 pseudo-element that can be specified with the single colon syntax (in addition to the double-colon syntax, which can be used for all pseudo-elements).
namespace_empty_string
parse_attribute_flags πŸ”’
parse_attribute_selector πŸ”’
parse_compound_selector πŸ”’
simple_selector_sequence : [ type_selector | universal ] [ HASH | class | attrib | pseudo | negation ]* | [ HASH | class | attrib | pseudo | negation ]+
parse_functional_pseudo_class πŸ”’
parse_has πŸ”’
parse_inner_compound_selector πŸ”’
Parses one compound selector suitable for nested stuff like :-moz-any, etc.
parse_is_where πŸ”’
parse_negation πŸ”’
Level 3: Parse one simple_selector. (Though we might insert a second implied β€œ|*” type selector.)
parse_nth_pseudo_class πŸ”’
parse_one_simple_selector πŸ”’
Parse a simple selector other than a type selector.
parse_qualified_name πŸ”’
Err(()): Invalid selector, abortOk(None(token)): Not a simple selector, could be something else. input was not consumed, but the token is still returned.Ok(Some(namespace, local_name)): None for the local name means a * universal selector
parse_selector πŸ”’
Build up a Selector. selector : simple_selector_sequence [ combinator simple_selector_sequence ]* ;
parse_simple_pseudo_class πŸ”’
parse_type_selector πŸ”’
Err(()): Invalid selector, abortOk(false): Not a type selector, could be something else. input was not consumed.Ok(true): Length 0 (*|*), 1 (*|E or ns|*) or 2 (|E or ns|E)
serialize_selector_list πŸ”’
to_ascii_lowercase πŸ”’
Returns a Cow::Borrowed if s is already ASCII lowercase, and a Cow::Owned if s had to be converted into ASCII lowercase.
try_parse_combinator πŸ”’

Type AliasesΒ§

SelectorData πŸ”’
SelectorParseError