From 54a9a232f8110364972a8eef966b7b7477573f4f Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 18 Oct 2021 14:48:33 +0700 Subject: Draw scrollbar in `Widget::draw` for `Scrollable` --- style/src/scrollable.rs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'style/src/scrollable.rs') diff --git a/style/src/scrollable.rs b/style/src/scrollable.rs index 65da9803..741d9d39 100644 --- a/style/src/scrollable.rs +++ b/style/src/scrollable.rs @@ -60,17 +60,8 @@ impl StyleSheet for Default { } } -impl std::default::Default for Box { +impl std::default::Default for &'static dyn StyleSheet { fn default() -> Self { - Box::new(Default) - } -} - -impl From for Box -where - T: 'static + StyleSheet, -{ - fn from(style: T) -> Self { - Box::new(style) + &Default } } -- cgit From eed19dcf81334d0849744f1918ba880d5a7acc1c Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 31 Oct 2021 17:39:24 +0700 Subject: Reintroduce `Box` for `style_sheet` in `Scrollable` --- style/src/scrollable.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'style/src/scrollable.rs') diff --git a/style/src/scrollable.rs b/style/src/scrollable.rs index 741d9d39..9de72add 100644 --- a/style/src/scrollable.rs +++ b/style/src/scrollable.rs @@ -60,8 +60,17 @@ impl StyleSheet for Default { } } -impl std::default::Default for &'static dyn StyleSheet { +impl std::default::Default for Box { fn default() -> Self { - &Default + Box::new(Default) + } +} + +impl<'a, T> From for Box +where + T: StyleSheet + 'a, +{ + fn from(style_sheet: T) -> Self { + Box::new(style_sheet) } } -- cgit From 157a40a56882ec1959034fa499b383e7f633aaf8 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 2 Nov 2021 16:02:05 +0700 Subject: Introduce generic lifetime to `Default` implementation for style sheets --- style/src/scrollable.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'style/src/scrollable.rs') diff --git a/style/src/scrollable.rs b/style/src/scrollable.rs index 9de72add..748ba888 100644 --- a/style/src/scrollable.rs +++ b/style/src/scrollable.rs @@ -60,7 +60,7 @@ impl StyleSheet for Default { } } -impl std::default::Default for Box { +impl<'a> std::default::Default for Box { fn default() -> Self { Box::new(Default) } -- cgit