macro_rules! impl_widget_builders {
($widget:ty) => { ... };
}Expand description
Generate all common builder methods for widgets with both state: WidgetState
and props: WidgetProps fields.
This is a convenience macro that combines impl_state_builders! and
impl_props_builders!.
Generated methods:
- State:
focused,disabled,fg,bg,is_focused,is_disabled,set_focused - Props:
element_id,class,classes
§Example
ⓘ
struct MyWidget {
label: String,
state: WidgetState,
props: WidgetProps,
}
impl MyWidget {
pub fn new(label: impl Into<String>) -> Self {
Self {
label: label.into(),
state: WidgetState::new(),
props: WidgetProps::new(),
}
}
}
// Generates: focused, disabled, fg, bg, is_focused, is_disabled,
// set_focused, element_id, class, classes
impl_widget_builders!(MyWidget);