Reintroduce Box for style_sheet in Checkbox
This commit is contained in:
parent
d36ce33a95
commit
fcc282bd76
4 changed files with 26 additions and 11 deletions
|
|
@ -31,7 +31,7 @@ pub struct Checkbox<'a, Message> {
|
|||
id: Option<String>,
|
||||
width: Length,
|
||||
#[allow(dead_code)]
|
||||
style_sheet: &'a dyn StyleSheet,
|
||||
style_sheet: Box<dyn StyleSheet + 'a>,
|
||||
}
|
||||
|
||||
impl<'a, Message> Checkbox<'a, Message> {
|
||||
|
|
@ -64,8 +64,11 @@ impl<'a, Message> Checkbox<'a, Message> {
|
|||
}
|
||||
|
||||
/// Sets the style of the [`Checkbox`].
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue