pub struct DynamicCssProperty {
pub dynamic_id: String,
pub default_value: CssProperty,
}
Expand description
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:
#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§
Source§impl DynamicCssProperty
impl DynamicCssProperty
pub fn is_inheritable(&self) -> bool
pub fn can_trigger_relayout(&self) -> bool
Trait Implementations§
Source§impl Clone for DynamicCssProperty
impl Clone for DynamicCssProperty
Source§fn clone(&self) -> DynamicCssProperty
fn clone(&self) -> DynamicCssProperty
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for DynamicCssProperty
impl Debug for DynamicCssProperty
Source§impl Hash for DynamicCssProperty
impl Hash for DynamicCssProperty
Source§impl Ord for DynamicCssProperty
impl Ord for DynamicCssProperty
Source§fn cmp(&self, other: &DynamicCssProperty) -> Ordering
fn cmp(&self, other: &DynamicCssProperty) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for DynamicCssProperty
impl PartialEq for DynamicCssProperty
Source§impl PartialOrd for DynamicCssProperty
impl PartialOrd for DynamicCssProperty
impl Eq for DynamicCssProperty
impl StructuralPartialEq for DynamicCssProperty
Auto Trait Implementations§
impl Freeze for DynamicCssProperty
impl RefUnwindSafe for DynamicCssProperty
impl Send for DynamicCssProperty
impl Sync for DynamicCssProperty
impl Unpin for DynamicCssProperty
impl UnwindSafe for DynamicCssProperty
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)