[][src]Struct azul_css::DynamicCssProperty

pub struct DynamicCssProperty {
    pub dynamic_id: String,
    pub default_value: CssProperty,
}

A DynamicCssProperty is a type of css property that can be changed on possibly every frame by the Rust code - for example to implement an On::Hover behaviour.

The syntax for such a property looks like this:

This example is not tested
#my_div {
   padding: var(--my_dynamic_property_id, 400px);
}

Azul will register a dynamic property with the key "my_dynamic_property_id" and the default value of 400px. If the property gets overridden during one frame, the overridden property takes precedence.

At runtime the style is immutable (which is a performance optimization - if we can assume that the property never changes at runtime), we can do some optimizations on it. Dynamic style properties can also be used for animations and conditional styles (i.e. hover, focus, etc.), thereby leading to cleaner code, since all of these special cases now use one single API.

Fields

dynamic_id: String

The stringified ID of this property, i.e. the "my_id" in width: var(--my_id, 500px).

default_value: CssProperty

Default values for this properties - one single value can control multiple properties!

Implementations

impl DynamicCssProperty[src]

pub fn is_inheritable(&self) -> bool[src]

pub fn can_trigger_relayout(&self) -> bool[src]

Trait Implementations

impl Clone for DynamicCssProperty[src]

impl Debug for DynamicCssProperty[src]

impl Eq for DynamicCssProperty[src]

impl Hash for DynamicCssProperty[src]

impl Ord for DynamicCssProperty[src]

impl PartialEq<DynamicCssProperty> for DynamicCssProperty[src]

impl PartialOrd<DynamicCssProperty> for DynamicCssProperty[src]

impl StructuralEq for DynamicCssProperty[src]

impl StructuralPartialEq for DynamicCssProperty[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.