Skip to main content

impl_traits

Macro impl_traits 

Source
macro_rules! impl_traits {
    ($type:ty { $($trait_name:ident => $field:ident),* $(,)? }) => { ... };
    (@single $type:ty, Animatable, $_field:ident) => { ... };
    (@single $type:ty, Timed, $field:ident) => { ... };
    (@single $type:ty, Styled, $field:ident) => { ... };
}
Expand description

Macro to implement common traits by delegating to embedded config fields.

Usage:

impl_traits!(Text {
    Animatable => animation,  // Vec<AnimationEffect> directly
    Timed => timing,
    Styled => style,          // CssStyle
});

This generates both the object-safe accessor trait AND the mutable builder trait (e.g. Styled + StyledMut).