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,
                )*
            )?
            $(
                %[borrowed$($borrowed_attr_control:tt)?]
                $(
                    $(#[$borrowed_field_attrs:meta])*
                    $borrowed_field_name:ident: $borrowed_field_ty:ty,
                )*
            )?
            $(
                %[owned$($owned_attr_control:tt)?]
                $(
                    $(#[$owned_field_attrs:meta])*
                    $owned_field_name:ident: $owned_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<'a> {
        %[cows]
        cow_string: str,
        %[borrowed]
        borrowed_data: &'a Foo,
        %[owned]
        owned_data: Bar,
        %[subthemes]
        font_theme: FontTheme,
    }
}