Trait stylecs::StyleComponent
source · pub trait StyleComponent: Any + RefUnwindSafe + UnwindSafe + Send + Sync + Debug + 'static {
// Provided methods
fn name() -> Name { ... }
fn authority() -> Identifier { ... }
fn inherited() -> bool { ... }
fn merge(&mut self, other: &Self) { ... }
}Expand description
A style component. Implementors can be stored within
Style.
Deriving this trait
This trait can be derived. It can be customized using the style attribute
with these parameters:
inherited: A boolean value,falseby default.name: An identifier. By default, the type’s name converted to snake case is used. For example, a type namedStyleComponentwould returnName::new(StyleComponent::authority(), "style_component").authority: An identifier. By default, this isIdentifier::private().merge: An expression to evaluate when merging.selfandotherare defined. By default, components do not merge.
Provided Methods§
sourcefn name() -> Name
fn name() -> Name
The unique name of this style component.
This function returns a qualified name. The default implementation uses
the type’s name converted to snake case. E.g., StyleCompoment becomes
style_component, and StyleComponent::authority() for the
authority.
Returns the authority of this component. By default, this returns
Identifier::private().
sourcefn inherited() -> bool
fn inherited() -> bool
Returns whether the component should be inherited. Affects the behavior
of Style::inherited_from
This provided imiplementation returns false.