pub trait StyleSheet<'a>: Sized + Parse<'a> {
type Rule: Parse<'a>;
// Provided method
fn parse_stylesheet(p: &mut Parser<'a>) -> Result<Vec<'a, Self::Rule>> { ... }
}
Expand description
This trait provides an implementation for parsing a StyleSheet.
It does not implement Parse, but provides parse_stylesheet(&mut Parser<'a>) -> Result<...>
, which can make
for a trivial Parse implementation. The type StyleSheet::Rule must be defined, and represents any Rule allowed
in a style sheet, which is the only top level item of the stylesheet.
StyleSheets are special in that they must discard CdcOrCdo tokens.
The steps parse_stylesheet
takes can be defined as:
<style-sheet>
│├─╮─╭─ <ws*> ─╮─╭╮─╭─ <cdcorcdo-token> ─╮─╭─ <rule> ──┤│
│ ╰─────────╯ ││ ╰────────────────────╯ │
╰─────────────╯╰────────────────────────╯
Required Associated Types§
Provided Methods§
fn parse_stylesheet(p: &mut Parser<'a>) -> Result<Vec<'a, Self::Rule>>
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.