pub struct StyleRule<'i> {
pub selectors: SelectorList<'i, Selectors>,
pub declarations: DeclarationBlock<'i>,
pub rules: CssRuleList<'i>,
pub loc: Location,
/* private fields */
}
Expand description
A CSS style rule.
Fields
selectors: SelectorList<'i, Selectors>
The selectors for the style rule.
declarations: DeclarationBlock<'i>
The declarations within the style rule.
rules: CssRuleList<'i>
Nested rules within the style rule.
loc: Location
The location of the rule in the source file.
Implementations
sourceimpl<'i> StyleRule<'i>
impl<'i> StyleRule<'i>
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
sourceimpl<'i> PartialEq<StyleRule<'i>> for StyleRule<'i>
impl<'i> PartialEq<StyleRule<'i>> for StyleRule<'i>
impl<'i> StructuralPartialEq for StyleRule<'i>
Auto Trait Implementations
impl<'i> RefUnwindSafe for StyleRule<'i>
impl<'i> Send for StyleRule<'i>
impl<'i> Sync for StyleRule<'i>
impl<'i> Unpin for StyleRule<'i>
impl<'i> UnwindSafe for StyleRule<'i>
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.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
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