#[repr(C)]pub struct CssPropertyWithConditions {
pub property: CssProperty,
pub apply_if: DynamicSelectorVec,
}Expand description
A CSS property with optional conditions for when it should be applied.
This replaces NodeDataInlineCssProperty with a more flexible system.
If apply_if is empty, the property always applies.
If apply_if contains conditions, ALL conditions must be satisfied for the property to apply.
Fields§
§property: CssPropertyThe actual CSS property value
apply_if: DynamicSelectorVecConditions that must all be satisfied for this property to apply. Empty means unconditional (always apply).
Implementations§
Source§impl CssPropertyWithConditions
impl CssPropertyWithConditions
Sourcepub const fn simple(property: CssProperty) -> CssPropertyWithConditions
pub const fn simple(property: CssProperty) -> CssPropertyWithConditions
Create an unconditional property (always applies) - const version
Sourcepub const fn with_single_condition(
property: CssProperty,
conditions: &'static [DynamicSelector],
) -> CssPropertyWithConditions
pub const fn with_single_condition( property: CssProperty, conditions: &'static [DynamicSelector], ) -> CssPropertyWithConditions
Create a property with a single condition (const version using slice reference)
Sourcepub fn with_condition(
property: CssProperty,
condition: DynamicSelector,
) -> CssPropertyWithConditions
pub fn with_condition( property: CssProperty, condition: DynamicSelector, ) -> CssPropertyWithConditions
Create a property with a single condition (non-const, allocates)
Sourcepub const fn with_conditions(
property: CssProperty,
conditions: DynamicSelectorVec,
) -> CssPropertyWithConditions
pub const fn with_conditions( property: CssProperty, conditions: DynamicSelectorVec, ) -> CssPropertyWithConditions
Create a property with multiple conditions (all must match)
Sourcepub const fn on_hover(property: CssProperty) -> CssPropertyWithConditions
pub const fn on_hover(property: CssProperty) -> CssPropertyWithConditions
Create a property that applies only on hover (const version)
Sourcepub const fn on_active(property: CssProperty) -> CssPropertyWithConditions
pub const fn on_active(property: CssProperty) -> CssPropertyWithConditions
Create a property that applies only when active (const version)
Sourcepub const fn on_focus(property: CssProperty) -> CssPropertyWithConditions
pub const fn on_focus(property: CssProperty) -> CssPropertyWithConditions
Create a property that applies only when focused (const version)
Sourcepub const fn when_disabled(property: CssProperty) -> CssPropertyWithConditions
pub const fn when_disabled(property: CssProperty) -> CssPropertyWithConditions
Create a property that applies only when disabled (const version)
Sourcepub fn on_os(
property: CssProperty,
os: OsCondition,
) -> CssPropertyWithConditions
pub fn on_os( property: CssProperty, os: OsCondition, ) -> CssPropertyWithConditions
Create a property that applies only on a specific OS (non-const, needs runtime value)
Sourcepub const fn dark_theme(property: CssProperty) -> CssPropertyWithConditions
pub const fn dark_theme(property: CssProperty) -> CssPropertyWithConditions
Create a property that applies only in dark theme (const version)
Sourcepub const fn light_theme(property: CssProperty) -> CssPropertyWithConditions
pub const fn light_theme(property: CssProperty) -> CssPropertyWithConditions
Create a property that applies only in light theme (const version)
Sourcepub const fn on_windows(property: CssProperty) -> CssPropertyWithConditions
pub const fn on_windows(property: CssProperty) -> CssPropertyWithConditions
Create a property for Windows only (const version)
Sourcepub const fn on_macos(property: CssProperty) -> CssPropertyWithConditions
pub const fn on_macos(property: CssProperty) -> CssPropertyWithConditions
Create a property for macOS only (const version)
Sourcepub const fn on_linux(property: CssProperty) -> CssPropertyWithConditions
pub const fn on_linux(property: CssProperty) -> CssPropertyWithConditions
Create a property for Linux only (const version)
Sourcepub fn matches(&self, ctx: &DynamicSelectorContext) -> bool
pub fn matches(&self, ctx: &DynamicSelectorContext) -> bool
Check if this property matches in the given context
Sourcepub fn is_conditional(&self) -> bool
pub fn is_conditional(&self) -> bool
Check if this property has any conditions
Sourcepub fn is_pseudo_state_only(&self) -> bool
pub fn is_pseudo_state_only(&self) -> bool
Check if this property is a pseudo-state conditional only (hover, active, focus, etc.)
Sourcepub fn is_layout_affecting(&self) -> bool
pub fn is_layout_affecting(&self) -> bool
Check if this property affects layout (width, height, margin, etc.) TODO: Implement when CssProperty has this method
Trait Implementations§
Source§impl Clone for CssPropertyWithConditions
impl Clone for CssPropertyWithConditions
Source§fn clone(&self) -> CssPropertyWithConditions
fn clone(&self) -> CssPropertyWithConditions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CssPropertyWithConditions
impl Debug for CssPropertyWithConditions
Source§impl FromIterator<CssPropertyWithConditions> for CssPropertyWithConditionsVec
impl FromIterator<CssPropertyWithConditions> for CssPropertyWithConditionsVec
Source§fn from_iter<T>(iter: T) -> CssPropertyWithConditionsVecwhere
T: IntoIterator<Item = CssPropertyWithConditions>,
fn from_iter<T>(iter: T) -> CssPropertyWithConditionsVecwhere
T: IntoIterator<Item = CssPropertyWithConditions>,
Source§impl Hash for CssPropertyWithConditions
impl Hash for CssPropertyWithConditions
Source§impl Ord for CssPropertyWithConditions
impl Ord for CssPropertyWithConditions
Source§fn cmp(&self, other: &CssPropertyWithConditions) -> Ordering
fn cmp(&self, other: &CssPropertyWithConditions) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for CssPropertyWithConditions
impl PartialOrd for CssPropertyWithConditions
impl Eq for CssPropertyWithConditions
impl StructuralPartialEq for CssPropertyWithConditions
Auto Trait Implementations§
impl Freeze for CssPropertyWithConditions
impl RefUnwindSafe for CssPropertyWithConditions
impl Send for CssPropertyWithConditions
impl Sync for CssPropertyWithConditions
impl Unpin for CssPropertyWithConditions
impl UnwindSafe for CssPropertyWithConditions
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