pub enum Rule<'a> {
Show 23 variants
Charset(CharsetRule),
ColorProfile(ColorProfileRule),
Container(ContainerRule<'a>),
CounterStyle(CounterStyleRule<'a>),
FontFace(FontFaceRule<'a>),
FontFeatureValues(FontFeatureValuesRule),
FontPaletteValues(FontPaletteValuesRule),
Import(ImportRule<'a>),
Keyframes(KeyframesRule<'a>),
Layer(LayerRule<'a>),
Media(MediaRule<'a>),
Namespace(NamespaceRule),
Page(PageRule<'a>),
Property(PropertyRule<'a>),
Scope(ScopeRule),
StartingStyle(StartingStyleRule<'a>),
Supports(SupportsRule<'a>),
Document(DocumentRule<'a>),
WebkitKeyframes(WebkitKeyframesRule<'a>),
MozDocument(MozDocumentRule<'a>),
UnknownAt(UnknownAtRule<'a>),
Style(StyleRule<'a>),
Unknown(UnknownQualifiedRule<'a>),
}Variants§
Charset(CharsetRule)
ColorProfile(ColorProfileRule)
Container(ContainerRule<'a>)
CounterStyle(CounterStyleRule<'a>)
FontFace(FontFaceRule<'a>)
FontFeatureValues(FontFeatureValuesRule)
FontPaletteValues(FontPaletteValuesRule)
Import(ImportRule<'a>)
Keyframes(KeyframesRule<'a>)
Layer(LayerRule<'a>)
Media(MediaRule<'a>)
Namespace(NamespaceRule)
Page(PageRule<'a>)
Property(PropertyRule<'a>)
Scope(ScopeRule)
StartingStyle(StartingStyleRule<'a>)
Supports(SupportsRule<'a>)
Document(DocumentRule<'a>)
WebkitKeyframes(WebkitKeyframesRule<'a>)
MozDocument(MozDocumentRule<'a>)
UnknownAt(UnknownAtRule<'a>)
Style(StyleRule<'a>)
Unknown(UnknownQualifiedRule<'a>)
Trait Implementations§
Source§impl<'a> NodeWithMetadata<CssMetadata> for Rule<'a>
impl<'a> NodeWithMetadata<CssMetadata> for Rule<'a>
Source§fn self_metadata(&self) -> CssMetadata
fn self_metadata(&self) -> CssMetadata
Returns the metadata contributed by this node itself, not including children.
Most nodes don’t contribute metadata, so can simply return
M::default().
Nodes like StyleRule or AtRules should return their own node kind flags here.Source§fn metadata(&self) -> CssMetadata
fn metadata(&self) -> CssMetadata
Returns the complete aggregated metadata for this node (self + children).
Default implementation merges children’s metadata with self_metadata().
Source§impl<'a> Ord for Rule<'a>
impl<'a> Ord for Rule<'a>
Source§impl<'a> PartialOrd for Rule<'a>
impl<'a> PartialOrd for Rule<'a>
Source§impl<'a> RuleVariants<'a> for Rule<'a>
impl<'a> RuleVariants<'a> for Rule<'a>
Source§type DeclarationValue = StyleValue<'a>
type DeclarationValue = StyleValue<'a>
The declaration value type used when converting declaration groups to rules.
Source§type Metadata = CssMetadata
type Metadata = CssMetadata
The metadata type used when converting declaration groups to rules.
Source§fn parse_at_rule<I>(p: &mut Parser<'a, I>, c: Cursor) -> ParserResult<Self>
fn parse_at_rule<I>(p: &mut Parser<'a, I>, c: Cursor) -> ParserResult<Self>
Like crate::Parse::parse() but with the additional context of the
name Cursor. This cursor is known to be
an AtKeyword, therefore this should return a Self reflecting a AtRule. If the
AtRule is not known, or otherwise fails then this should Err and RuleVariants::parse_unknown_at_rule() can
be called. Read moreSource§fn parse_unknown_at_rule<I>(
p: &mut Parser<'a, I>,
_name: Cursor,
) -> ParserResult<Self>
fn parse_unknown_at_rule<I>( p: &mut Parser<'a, I>, _name: Cursor, ) -> ParserResult<Self>
Like crate::Parse::parse() but with the additional context of the
name Cursor. This cursor is known to be
an AtKeyword and that RuleVariants::parse_at_rule() failed. This should therefore return a Self that represents
an Unknown AtRule, or otherwise Err. Read moreSource§fn parse_qualified_rule<I>(
p: &mut Parser<'a, I>,
_name: Cursor,
) -> ParserResult<Self>
fn parse_qualified_rule<I>( p: &mut Parser<'a, I>, _name: Cursor, ) -> ParserResult<Self>
Like crate::Parse::parse() but with the additional context that the next cursor is not an
AtKeyword, therefore this can attempt to parse a Qualified Rule. If the rule
fails to parse, then RuleVariants::parse_unknown_qualified_rule() will be called. Read more
Source§fn parse_unknown_qualified_rule<I>(
p: &mut Parser<'a, I>,
_name: Cursor,
) -> ParserResult<Self>
fn parse_unknown_qualified_rule<I>( p: &mut Parser<'a, I>, _name: Cursor, ) -> ParserResult<Self>
Like crate::Parse::parse() but with the additional context that the next cursor is not an
AtKeyword, and that RuleVariants::parse_qualified_rule() has failed.
Therefore this should attempt to parse an Unknown Qualified Rule, or Err. Read more
Source§fn bad_declaration(_: BadDeclaration<'a>) -> Option<Self>
fn bad_declaration(_: BadDeclaration<'a>) -> Option<Self>
If all of the parse steps have failed, including parsing the Unknown Qualified Rule, we may want to consume a bad
declaration (especially if the parser is in a nested context). This is done automatically on failing to parse
an Unknown Qualified Rule, and this method is given the BadDeclaration. Read more
Source§fn is_unknown(&self) -> bool
fn is_unknown(&self) -> bool
Determines if the parsed Self was parsed as an unknown rule (UnknownAtRule or UnknownQualifiedRule). Read more
Source§fn from_declaration_group(
_group: DeclarationGroup<'a, Self::DeclarationValue, Self::Metadata>,
) -> Option<Self>
fn from_declaration_group( _group: DeclarationGroup<'a, Self::DeclarationValue, Self::Metadata>, ) -> Option<Self>
Creates a rule variant from a group of declarations. Read more
fn parse_rule_variants<I>(p: &mut Parser<'a, I>) -> Result<Self, Diagnostic>
Source§impl<'a> SemanticEq for Rule<'a>
impl<'a> SemanticEq for Rule<'a>
Source§fn semantic_eq(&self, other: &Self) -> bool
fn semantic_eq(&self, other: &Self) -> bool
Returns
true if self and other are semantically equal.Source§impl<'a> ToCursors for Rule<'a>
impl<'a> ToCursors for Rule<'a>
fn to_cursors(&self, s: &mut impl CursorSink)
impl<'a> Eq for Rule<'a>
impl<'a> StructuralPartialEq for Rule<'a>
Auto Trait Implementations§
impl<'a> Freeze for Rule<'a>
impl<'a> !RefUnwindSafe for Rule<'a>
impl<'a> !Send for Rule<'a>
impl<'a> !Sync for Rule<'a>
impl<'a> Unpin for Rule<'a>
impl<'a> !UnwindSafe for Rule<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more