summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--native/src/widget/pane_grid.rs6
-rw-r--r--style/src/pane_grid.rs13
2 files changed, 14 insertions, 5 deletions
diff --git a/native/src/widget/pane_grid.rs b/native/src/widget/pane_grid.rs
index 22c18c05..48243c0b 100644
--- a/native/src/widget/pane_grid.rs
+++ b/native/src/widget/pane_grid.rs
@@ -99,7 +99,7 @@ pub struct PaneGrid<'a, Message, Renderer> {
on_click: Option<Box<dyn Fn(Pane) -> Message + 'a>>,
on_drag: Option<Box<dyn Fn(DragEvent) -> Message + 'a>>,
on_resize: Option<(u16, Box<dyn Fn(ResizeEvent) -> Message + 'a>)>,
- style_sheet: &'a dyn StyleSheet,
+ style_sheet: Box<dyn StyleSheet + 'a>,
}
impl<'a, Message, Renderer> PaneGrid<'a, Message, Renderer>
@@ -191,8 +191,8 @@ where
}
/// Sets the style of the [`PaneGrid`].
- pub fn style(mut self, style: &'a dyn StyleSheet) -> Self {
- self.style_sheet = style;
+ pub fn style(mut self, style: impl Into<Box<dyn StyleSheet + 'a>>) -> Self {
+ self.style_sheet = style.into();
self
}
}
diff --git a/style/src/pane_grid.rs b/style/src/pane_grid.rs
index 032fcb6d..89cf39ea 100644
--- a/style/src/pane_grid.rs
+++ b/style/src/pane_grid.rs
@@ -35,8 +35,17 @@ impl StyleSheet for Default {
}
}
-impl std::default::Default for &'static dyn StyleSheet {
+impl std::default::Default for Box<dyn StyleSheet> {
fn default() -> Self {
- &Default
+ Box::new(Default)
+ }
+}
+
+impl<'a, T> From<T> for Box<dyn StyleSheet + 'a>
+where
+ T: StyleSheet + 'a,
+{
+ fn from(style_sheet: T) -> Self {
+ Box::new(style_sheet)
}
}