macro_rules! configurable {
(@impl $(#[$meta:meta])*; $view:ident, $config:ty, $axis:expr) => { ... };
(@impl_dynamic $(#[$meta:meta])*; $view:ident, $config:ty, $stretch_fn:expr) => { ... };
($(#[$meta:meta])* $view:ident, $config:ty, |$param:ident| $body:expr) => { ... };
($(#[$meta:meta])* $view:ident, $config:ty, $axis:expr) => { ... };
($(#[$meta:meta])* $view:ident, $config:ty) => { ... };
}Expand description
Creates a configurable view with builder pattern methods.
This macro generates a wrapper struct and builder methods for configuring views, following the builder pattern commonly used in UI frameworks.
§Usage
ⓘ
// Default stretch axis (None) - for content-sized views
configurable!(Button, ButtonConfig);
// With explicit stretch axis - for views that expand
configurable!(Slider, SliderConfig, StretchAxis::Horizontal);
configurable!(Color, ColorConfig, StretchAxis::Both);
// With dynamic stretch axis (closure) - for runtime-dependent behavior
configurable!(Progress, ProgressConfig, |config| match config.style {
ProgressStyle::Linear => StretchAxis::Horizontal,
ProgressStyle::Circular => StretchAxis::None,
});