Macro freya_hooks::define_theme

source ยท
macro_rules! define_theme {
    (NOTHING=) => { ... };
    (
        $(#[$attrs:meta])*
        $(%[component$($component_attr_control:tt)?])?
        $vis:vis $name:ident $(<$lifetime:lifetime>)? {
            $(
                %[cows$($cows_attr_control:tt)?]
                $(
                    $(#[$cow_field_attrs:meta])*
                    $cow_field_name:ident: $cow_field_ty:ty,
                )*
            )?
            $(
                %[subthemes$($subthemes_attr_control:tt)?]
                $(
                    $(#[$subtheme_field_attrs:meta])*
                    $subtheme_field_name:ident: $subtheme_field_ty_name:ident $(<$subtheme_field_ty_lifetime:lifetime>)?,
                )*
            )?
    }) => { ... };
}
Expand description

Example usage:

define_theme! {
    %[component]
    pub Test {
        %[cows]
        cow_string: str,
        %[subthemes]
        font_theme: FontTheme,
    }
}