pub struct Rule {
pub selector: Selector<SelectorImpl>,
pub hashes: AncestorHashes,
pub source_order: u32,
pub layer_id: LayerId,
pub container_condition_id: ContainerConditionId,
pub is_starting_style: bool,
pub scope_condition_id: ScopeConditionId,
pub style_source: StyleSource,
}
Expand description
A rule, that wraps a style rule, but represents a single selector of the rule.
Fields§
§selector: Selector<SelectorImpl>
The selector this struct represents. We store this and the any_{important,normal} booleans inline in the Rule to avoid pointer-chasing when gathering applicable declarations, which can ruin performance when there are a lot of rules.
hashes: AncestorHashes
The ancestor hashes associated with the selector.
source_order: u32
The source order this style rule appears in. Note that we only use three bytes to store this value in ApplicableDeclarationsBlock, so we could repurpose that storage here if we needed to.
layer_id: LayerId
The current layer id of this style rule.
container_condition_id: ContainerConditionId
The current @container rule id.
is_starting_style: bool
True if this rule is inside @starting-style.
scope_condition_id: ScopeConditionId
The current @scope rule id.
style_source: StyleSource
The actual style rule.
Implementations§
source§impl Rule
impl Rule
sourcepub fn specificity(&self) -> u32
pub fn specificity(&self) -> u32
Returns the specificity of the rule.
sourcepub fn to_applicable_declaration_block(
&self,
level: CascadeLevel,
cascade_data: &CascadeData,
scope_proximity: ScopeProximity,
) -> ApplicableDeclarationBlock
pub fn to_applicable_declaration_block( &self, level: CascadeLevel, cascade_data: &CascadeData, scope_proximity: ScopeProximity, ) -> ApplicableDeclarationBlock
Turns this rule into an ApplicableDeclarationBlock
for the given
cascade level.
sourcepub fn new(
selector: Selector<SelectorImpl>,
hashes: AncestorHashes,
style_source: StyleSource,
source_order: u32,
layer_id: LayerId,
container_condition_id: ContainerConditionId,
is_starting_style: bool,
scope_condition_id: ScopeConditionId,
) -> Self
pub fn new( selector: Selector<SelectorImpl>, hashes: AncestorHashes, style_source: StyleSource, source_order: u32, layer_id: LayerId, container_condition_id: ContainerConditionId, is_starting_style: bool, scope_condition_id: ScopeConditionId, ) -> Self
Creates a new Rule.
Trait Implementations§
source§impl MallocSizeOf for Rule
impl MallocSizeOf for Rule
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl SelectorMapEntry for Rule
impl SelectorMapEntry for Rule
source§fn selector(&self) -> SelectorIter<'_, SelectorImpl>
fn selector(&self) -> SelectorIter<'_, SelectorImpl>
Auto Trait Implementations§
impl Freeze for Rule
impl !RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl !UnwindSafe for Rule
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more