diff options
author | 2021-10-31 17:02:59 +0700 | |
---|---|---|
committer | 2021-10-31 17:02:59 +0700 | |
commit | 40a5de581144886571504b762719f057dbb2e871 (patch) | |
tree | d931882c7840367c6ddd766e7d9e8cec62d0130f /native/src/widget/container.rs | |
parent | fcc282bd76c88f389d510411b0ae73e1a4eaf317 (diff) | |
download | iced-40a5de581144886571504b762719f057dbb2e871.tar.gz iced-40a5de581144886571504b762719f057dbb2e871.tar.bz2 iced-40a5de581144886571504b762719f057dbb2e871.zip |
Reintroduce `Box` for `style_sheet` in `Container`
Diffstat (limited to 'native/src/widget/container.rs')
-rw-r--r-- | native/src/widget/container.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/native/src/widget/container.rs b/native/src/widget/container.rs index 006e07c6..5ad07d6d 100644 --- a/native/src/widget/container.rs +++ b/native/src/widget/container.rs @@ -28,7 +28,7 @@ pub struct Container<'a, Message, Renderer> { max_height: u32, horizontal_alignment: alignment::Horizontal, vertical_alignment: alignment::Vertical, - style_sheet: &'a dyn StyleSheet, + style_sheet: Box<dyn StyleSheet + 'a>, content: Element<'a, Message, Renderer>, } @@ -109,8 +109,11 @@ where } /// Sets the style of the [`Container`]. - pub fn style(mut self, style_sheet: &'a dyn StyleSheet) -> Self { - self.style_sheet = style_sheet; + pub fn style( + mut self, + style_sheet: impl Into<Box<dyn StyleSheet + 'a>>, + ) -> Self { + self.style_sheet = style_sheet.into(); self } } |