diff options
Diffstat (limited to 'widget')
-rw-r--r-- | widget/src/container.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/widget/src/container.rs b/widget/src/container.rs index 7eb50120..c3a66360 100644 --- a/widget/src/container.rs +++ b/widget/src/container.rs @@ -612,6 +612,12 @@ pub trait Catalog { /// A styling function for a [`Container`]. pub type StyleFn<'a, Theme> = Box<dyn Fn(&Theme) -> Style + 'a>; +impl<'a, Theme> From<Style> for StyleFn<'a, Theme> { + fn from(style: Style) -> Self { + Box::new(move |_theme| style) + } +} + impl Catalog for Theme { type Class<'a> = StyleFn<'a, Self>; |