Trait cssparser::QualifiedRuleParser
[−]
[src]
pub trait QualifiedRuleParser<'i> { type Prelude; type QualifiedRule; type Error: 'i; fn parse_prelude<'t>(
&mut self,
input: &mut Parser<'i, 't>
) -> Result<Self::Prelude, ParseError<'i, Self::Error>> { ... } fn parse_block<'t>(
&mut self,
prelude: Self::Prelude,
input: &mut Parser<'i, 't>
) -> Result<Self::QualifiedRule, ParseError<'i, Self::Error>> { ... } }
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.
type Error: 'i
The error type that is included in the ParseError value that can be returned.
Provided Methods
fn parse_prelude<'t>(
&mut self,
input: &mut Parser<'i, 't>
) -> Result<Self::Prelude, ParseError<'i, Self::Error>>
&mut self,
input: &mut Parser<'i, 't>
) -> Result<Self::Prelude, ParseError<'i, Self::Error>>
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<'t>(
&mut self,
prelude: Self::Prelude,
input: &mut Parser<'i, 't>
) -> Result<Self::QualifiedRule, ParseError<'i, Self::Error>>
&mut self,
prelude: Self::Prelude,
input: &mut Parser<'i, 't>
) -> Result<Self::QualifiedRule, ParseError<'i, Self::Error>>
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.