From 628df6953884508569a4b99d28cf618577e162fa Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 9 Mar 2024 12:24:40 +0100 Subject: Make `component` example generic over `Theme` --- examples/component/src/main.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'examples/component/src') diff --git a/examples/component/src/main.rs b/examples/component/src/main.rs index 4670824d..a1572b1d 100644 --- a/examples/component/src/main.rs +++ b/examples/component/src/main.rs @@ -81,7 +81,10 @@ mod numeric_input { } } - impl Component for NumericInput { + impl Component for NumericInput + where + Theme: button::DefaultStyle + text_input::DefaultStyle + 'static, + { type State = (); type Event = Event; @@ -111,7 +114,7 @@ mod numeric_input { } } - fn view(&self, _state: &Self::State) -> Element { + fn view(&self, _state: &Self::State) -> Element<'_, Event, Theme> { let button = |label, on_press| { button( text(label) @@ -152,8 +155,10 @@ mod numeric_input { } } - impl<'a, Message> From> for Element<'a, Message> + impl<'a, Message, Theme> From> + for Element<'a, Message, Theme> where + Theme: button::DefaultStyle + text_input::DefaultStyle + 'static, Message: 'a, { fn from(numeric_input: NumericInput) -> Self { -- cgit