diff options
author | 2024-03-09 12:24:40 +0100 | |
---|---|---|
committer | 2024-03-09 12:24:40 +0100 | |
commit | 628df6953884508569a4b99d28cf618577e162fa (patch) | |
tree | c4d2173b0b302bbed97528593a16b39f7df21ecf /examples | |
parent | e236bd695aae4f07518479983c3da2b214f0b361 (diff) | |
download | iced-628df6953884508569a4b99d28cf618577e162fa.tar.gz iced-628df6953884508569a4b99d28cf618577e162fa.tar.bz2 iced-628df6953884508569a4b99d28cf618577e162fa.zip |
Make `component` example generic over `Theme`
Diffstat (limited to 'examples')
-rw-r--r-- | examples/component/src/main.rs | 11 |
1 files changed, 8 insertions, 3 deletions
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<Message> Component<Message> for NumericInput<Message> { + impl<Message, Theme> Component<Message, Theme> for NumericInput<Message> + 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<Event> { + 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<NumericInput<Message>> for Element<'a, Message> + impl<'a, Message, Theme> From<NumericInput<Message>> + for Element<'a, Message, Theme> where + Theme: button::DefaultStyle + text_input::DefaultStyle + 'static, Message: 'a, { fn from(numeric_input: NumericInput<Message>) -> Self { |