Reintroduce Box for style_sheet in Slider

This commit is contained in:
Héctor Ramón Jiménez 2021-10-31 17:42:43 +07:00
parent eed19dcf81
commit 0c76e0307f
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
5 changed files with 26 additions and 11 deletions

View file

@ -41,7 +41,7 @@ pub struct Slider<'a, T, Message> {
#[allow(dead_code)]
width: Length,
#[allow(dead_code)]
style_sheet: &'a dyn StyleSheet,
style_sheet: Box<dyn StyleSheet + 'a>,
}
impl<'a, T, Message> Slider<'a, T, Message>
@ -96,7 +96,10 @@ where
}
/// Sets the style of the [`Slider`].
pub fn style(mut self, style_sheet: &'a dyn StyleSheet) -> Self {
pub fn style(
mut self,
style_sheet: impl Into<Box<dyn StyleSheet + 'a>>,
) -> Self {
self.style_sheet = style_sheet.into();
self
}