Trait cssparser::QualifiedRuleParser
[−]
[src]
pub trait QualifiedRuleParser { type Prelude; type QualifiedRule; fn parse_prelude(&mut self, input: &mut Parser) -> Result<Self::Prelude, ()> { ... } fn parse_block(&mut self,
prelude: Self::Prelude,
input: &mut Parser)
-> Result<Self::QualifiedRule, ()> { ... } }
A trait to provide various parsing of qualified rules.
For example, there could be different implementations
for top-level qualified rules (i.e. style rules with Selectors as prelude)
and for qualified rules inside @keyframes
(keyframe rules with keyframe selectors as prelude).
Default implementations that reject all qualified rules are provided,
so that impl QualifiedRuleParser<(), ()> for ... {}
can be used
for example for using RuleListParser
to parse a rule list with only at-rules
(such as inside @font-feature-values
).
Associated Types
type Prelude
The intermediate representation of a qualified rule prelude.
type QualifiedRule
The finished representation of a qualified rule.
Provided Methods
fn parse_prelude(&mut self, input: &mut Parser) -> Result<Self::Prelude, ()>
Parse the prelude of a qualified rule. For style rules, this is as Selector list.
Return the representation of the prelude,
or Err(())
to ignore the entire at-rule as invalid.
The prelude is the part before the { /* ... */ }
block.
The given input
is a "delimited" parser
that ends where the prelude should end (before the next {
).
fn parse_block(&mut self,
prelude: Self::Prelude,
input: &mut Parser)
-> Result<Self::QualifiedRule, ()>
prelude: Self::Prelude,
input: &mut Parser)
-> Result<Self::QualifiedRule, ()>
Parse the content of a { /* ... */ }
block for the body of the qualified rule.
Return the finished representation of the qualified rule
as returned by RuleListParser::next
,
or Err(())
to ignore the entire at-rule as invalid.