Introduce state lifetime for style_sheet in PickList
This commit is contained in:
parent
89d50c0243
commit
6504dca059
2 changed files with 4 additions and 4 deletions
|
|
@ -36,7 +36,7 @@ where
|
||||||
padding: Padding,
|
padding: Padding,
|
||||||
text_size: Option<u16>,
|
text_size: Option<u16>,
|
||||||
font: Renderer::Font,
|
font: Renderer::Font,
|
||||||
style_sheet: Box<dyn StyleSheet>,
|
style_sheet: Box<dyn StyleSheet + 'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The local state of a [`PickList`].
|
/// The local state of a [`PickList`].
|
||||||
|
|
@ -138,7 +138,7 @@ where
|
||||||
/// Sets the style of the [`PickList`].
|
/// Sets the style of the [`PickList`].
|
||||||
pub fn style(
|
pub fn style(
|
||||||
mut self,
|
mut self,
|
||||||
style_sheet: impl Into<Box<dyn StyleSheet>>,
|
style_sheet: impl Into<Box<dyn StyleSheet + 'a>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.style_sheet = style_sheet.into();
|
self.style_sheet = style_sheet.into();
|
||||||
self
|
self
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,9 @@ impl std::default::Default for Box<dyn StyleSheet> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> From<T> for Box<dyn StyleSheet>
|
impl<'a, T> From<T> for Box<dyn StyleSheet + 'a>
|
||||||
where
|
where
|
||||||
T: 'static + StyleSheet,
|
T: 'a + StyleSheet,
|
||||||
{
|
{
|
||||||
fn from(style: T) -> Self {
|
fn from(style: T) -> Self {
|
||||||
Box::new(style)
|
Box::new(style)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue