pub trait CustomStyleProperty:
'static
+ Send
+ Sync {
// Required methods
fn as_any(&self) -> &(dyn Any + 'static);
fn eq_property(&self, other: &(dyn CustomStyleProperty + 'static)) -> bool;
}Expand description
A style property defined outside of GPUI’s core style structs.
Engines and forks carry their own rendering extensions - a backdrop blur
radius, a custom shader’s parameters - through the style cascade by defining
a type and setting it with Styled::custom_style, rather than adding a
field to Style that every consumer of this crate has to know about.
The type itself keys the property, so a reader recovers exactly the type
that was set. Any Send + Sync + PartialEq + 'static type is a custom
property as-is; there is nothing to implement. Properties must be
PartialEq because merging and subtracting style refinements diffs them.
Required Methods§
Sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Upcasts to Any so CustomStyles::get can recover the concrete type.
Sourcefn eq_property(&self, other: &(dyn CustomStyleProperty + 'static)) -> bool
fn eq_property(&self, other: &(dyn CustomStyleProperty + 'static)) -> bool
Compares two properties that share a concrete type.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".