Struct lightningcss::rules::style::StyleRule
source · pub struct StyleRule<'i, R = DefaultAtRule> {
pub selectors: SelectorList<'i>,
pub vendor_prefix: VendorPrefix,
pub declarations: DeclarationBlock<'i>,
pub rules: CssRuleList<'i, R>,
pub loc: Location,
}
Expand description
A CSS style rule.
Fields§
§selectors: SelectorList<'i>
The selectors for the style rule.
vendor_prefix: VendorPrefix
A vendor prefix override, used during selector printing.
declarations: DeclarationBlock<'i>
The declarations within the style rule.
rules: CssRuleList<'i, R>
Nested rules within the style rule.
loc: Location
The location of the rule in the source file.
Implementations§
source§impl<'i, T> StyleRule<'i, T>
impl<'i, T> StyleRule<'i, T>
sourcepub fn is_compatible(&self, targets: Option<Browsers>) -> bool
pub fn is_compatible(&self, targets: Option<Browsers>) -> bool
Returns whether the selectors in the rule are compatible with all of the given browser targets.
sourcepub fn property_location<'t>(
&self,
code: &'i str,
index: usize
) -> Result<(Range<SourceLocation>, Range<SourceLocation>), ParseError<'i, ParserError<'i>>>
pub fn property_location<'t>(
&self,
code: &'i str,
index: usize
) -> Result<(Range<SourceLocation>, Range<SourceLocation>), ParseError<'i, ParserError<'i>>>
Returns the line and column range of the property key and value at the given index in this style rule.
For performance and memory efficiency in non-error cases, source locations are not stored during parsing. Instead, they are computed lazily using the original source string that was used to parse the stylesheet/rule.
Trait Implementations§
source§impl<'i, R: PartialEq> PartialEq<StyleRule<'i, R>> for StyleRule<'i, R>
impl<'i, R: PartialEq> PartialEq<StyleRule<'i, R>> for StyleRule<'i, R>
source§impl<'i, R, __V: Visitor<'i, R>> Visit<'i, R, __V> for StyleRule<'i, R>where
R: Visit<'i, R, __V>,
impl<'i, R, __V: Visitor<'i, R>> Visit<'i, R, __V> for StyleRule<'i, R>where
R: Visit<'i, R, __V>,
source§const CHILD_TYPES: VisitTypes = _
const CHILD_TYPES: VisitTypes = _
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. Read more
source§fn visit_children(&mut self, visitor: &mut __V)
fn visit_children(&mut self, visitor: &mut __V)
Visit the children of this value.
impl<'i, R> StructuralPartialEq for StyleRule<'i, R>
Auto Trait Implementations§
impl<'i, R> RefUnwindSafe for StyleRule<'i, R>where
R: RefUnwindSafe,
impl<'i, R> Send for StyleRule<'i, R>where
R: Send,
impl<'i, R> Sync for StyleRule<'i, R>where
R: Sync,
impl<'i, R> Unpin for StyleRule<'i, R>where
R: Unpin,
impl<'i, R> UnwindSafe for StyleRule<'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