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: AncestorHashesThe ancestor hashes associated with the selector.
source_order: u32The 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: LayerIdThe current layer id of this style rule.
container_condition_id: ContainerConditionIdThe current @container rule id.
is_starting_style: boolTrue if this rule is inside @starting-style.
scope_condition_id: ScopeConditionIdThe current @scope rule id.
style_source: StyleSourceThe 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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