Enum lightningcss::rules::CssRule
source · pub enum CssRule<'i, R = DefaultAtRule> {
Show 21 variants
Media(MediaRule<'i, R>),
Import(ImportRule<'i>),
Style(StyleRule<'i, R>),
Keyframes(KeyframesRule<'i>),
FontFace(FontFaceRule<'i>),
FontPaletteValues(FontPaletteValuesRule<'i>),
Page(PageRule<'i>),
Supports(SupportsRule<'i, R>),
CounterStyle(CounterStyleRule<'i>),
Namespace(NamespaceRule<'i>),
MozDocument(MozDocumentRule<'i, R>),
Nesting(NestingRule<'i, R>),
Viewport(ViewportRule<'i>),
CustomMedia(CustomMediaRule<'i>),
LayerStatement(LayerStatementRule<'i>),
LayerBlock(LayerBlockRule<'i, R>),
Property(PropertyRule<'i>),
Container(ContainerRule<'i, R>),
Ignored,
Unknown(UnknownAtRule<'i>),
Custom(R),
}
Expand description
A CSS rule.
Variants§
Media(MediaRule<'i, R>)
A @media
rule.
Import(ImportRule<'i>)
An @import
rule.
Style(StyleRule<'i, R>)
A style rule.
Keyframes(KeyframesRule<'i>)
A @keyframes
rule.
FontFace(FontFaceRule<'i>)
A @font-face
rule.
FontPaletteValues(FontPaletteValuesRule<'i>)
A @font-palette-values
rule.
Page(PageRule<'i>)
A @page
rule.
Supports(SupportsRule<'i, R>)
A @supports
rule.
CounterStyle(CounterStyleRule<'i>)
A @counter-style
rule.
Namespace(NamespaceRule<'i>)
A @namespace
rule.
MozDocument(MozDocumentRule<'i, R>)
A @-moz-document
rule.
Nesting(NestingRule<'i, R>)
A @nest
rule.
Viewport(ViewportRule<'i>)
A @viewport
rule.
CustomMedia(CustomMediaRule<'i>)
A @custom-media
rule.
LayerStatement(LayerStatementRule<'i>)
A @layer
statement rule.
LayerBlock(LayerBlockRule<'i, R>)
A @layer
block rule.
Property(PropertyRule<'i>)
A @property
rule.
Container(ContainerRule<'i, R>)
A @container
rule.
Ignored
A placeholder for a rule that was removed.
Unknown(UnknownAtRule<'i>)
An unknown at-rule.
Custom(R)
A custom at-rule.
Implementations§
source§impl<'i> CssRule<'i, DefaultAtRule>
impl<'i> CssRule<'i, DefaultAtRule>
sourcepub fn parse<'t>(
input: &mut Parser<'i, 't>,
options: &ParserOptions<'_, 'i>
) -> Result<Self, ParseError<'i, ParserError<'i>>>
pub fn parse<'t>( input: &mut Parser<'i, 't>, options: &ParserOptions<'_, 'i> ) -> Result<Self, ParseError<'i, ParserError<'i>>>
Parse a single rule.
sourcepub fn parse_string(
input: &'i str,
options: ParserOptions<'_, 'i>
) -> Result<Self, ParseError<'i, ParserError<'i>>>
pub fn parse_string( input: &'i str, options: ParserOptions<'_, 'i> ) -> Result<Self, ParseError<'i, ParserError<'i>>>
Parse a single rule from a string.
source§impl<'i, T> CssRule<'i, T>
impl<'i, T> CssRule<'i, T>
sourcepub fn parse_with<'t, P: AtRuleParser<'i, AtRule = T>>(
input: &mut Parser<'i, 't>,
options: &ParserOptions<'_, 'i>,
at_rule_parser: &mut P
) -> Result<Self, ParseError<'i, ParserError<'i>>>
pub fn parse_with<'t, P: AtRuleParser<'i, AtRule = T>>( input: &mut Parser<'i, 't>, options: &ParserOptions<'_, 'i>, at_rule_parser: &mut P ) -> Result<Self, ParseError<'i, ParserError<'i>>>
Parse a single rule.
sourcepub fn parse_string_with<P: AtRuleParser<'i, AtRule = T>>(
input: &'i str,
options: ParserOptions<'_, 'i>,
at_rule_parser: &mut P
) -> Result<Self, ParseError<'i, ParserError<'i>>>
pub fn parse_string_with<P: AtRuleParser<'i, AtRule = T>>( input: &'i str, options: ParserOptions<'_, 'i>, at_rule_parser: &mut P ) -> Result<Self, ParseError<'i, ParserError<'i>>>
Parse a single rule from a string.
Trait Implementations§
source§impl<'i, 'de: 'i, R: Deserialize<'de>> Deserialize<'de> for CssRule<'i, R>
Available on crate feature serde
only.
impl<'i, 'de: 'i, R: Deserialize<'de>> Deserialize<'de> for CssRule<'i, R>
Available on crate feature
serde
only.source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<'i, R: JsonSchema> JsonSchema for CssRule<'i, R>
impl<'i, R: JsonSchema> JsonSchema for CssRule<'i, R>
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moresource§impl<'i, R: PartialEq> PartialEq<CssRule<'i, R>> for CssRule<'i, R>
impl<'i, R: PartialEq> PartialEq<CssRule<'i, R>> for CssRule<'i, R>
source§impl<'a, 'i, T: ToCss> ToCss for CssRule<'i, T>
impl<'a, 'i, T: ToCss> ToCss for CssRule<'i, T>
source§fn to_css<W>(
&self,
dest: &mut Printer<'_, '_, '_, W>
) -> Result<(), PrinterError>where
W: Write,
fn to_css<W>( &self, dest: &mut Printer<'_, '_, '_, W> ) -> Result<(), PrinterError>where W: Write,
Serialize
self
in CSS syntax, writing to dest
.source§fn to_css_string(
&self,
options: PrinterOptions<'_>
) -> Result<String, PrinterError>
fn to_css_string( &self, options: PrinterOptions<'_> ) -> Result<String, PrinterError>
Serialize
self
in CSS syntax and return a string. Read moresource§impl<'i, R, __V: Visitor<'i, R>> Visit<'i, R, __V> for CssRule<'i, R>where
R: Visit<'i, R, __V>,
impl<'i, R, __V: Visitor<'i, R>> Visit<'i, R, __V> for CssRule<'i, R>where R: Visit<'i, R, __V>,
source§const CHILD_TYPES: VisitTypes = _
const CHILD_TYPES: VisitTypes = _
Available on crate feature
visitor
only.The types of values contained within this value and its children.
This is used to skip branches that don’t have any values requested
by the Visitor.
impl<'i, R> StructuralPartialEq for CssRule<'i, R>
Auto Trait Implementations§
impl<'i, R> RefUnwindSafe for CssRule<'i, R>where R: RefUnwindSafe,
impl<'i, R> Send for CssRule<'i, R>where R: Send,
impl<'i, R> Sync for CssRule<'i, R>where R: Sync,
impl<'i, R> Unpin for CssRule<'i, R>where R: Unpin,
impl<'i, R> UnwindSafe for CssRule<'i, R>where R: UnwindSafe,
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer