diff --git a/src/application.rs b/src/application.rs index e068d87a..85ad755b 100644 --- a/src/application.rs +++ b/src/application.rs @@ -75,7 +75,7 @@ pub use timed::timed; pub fn application( boot: impl Boot, update: impl Update, - view: impl for<'a> self::View<'a, State, Message, Theme, Renderer>, + view: impl for<'a> View<'a, State, Message, Theme, Renderer>, ) -> Application> where State: 'static, @@ -482,19 +482,12 @@ where /// returns any `Into>`. pub trait Update { /// Processes the message and updates the state of the [`Application`]. - fn update( - &self, - state: &mut State, - message: Message, - ) -> impl Into>; + fn update(&self, state: &mut State, message: Message) -> Task; } impl Update for () { - fn update( - &self, - _state: &mut State, - _message: Message, - ) -> impl Into> { + fn update(&self, _state: &mut State, _message: Message) -> Task { + Task::none() } } @@ -503,12 +496,8 @@ where T: Fn(&mut State, Message) -> C, C: Into>, { - fn update( - &self, - state: &mut State, - message: Message, - ) -> impl Into> { - self(state, message) + fn update(&self, state: &mut State, message: Message) -> Task { + self(state, message).into() } } @@ -518,10 +507,7 @@ where /// returns any `Into>`. pub trait View<'a, State, Message, Theme, Renderer> { /// Produces the widget of the [`Application`]. - fn view( - &self, - state: &'a State, - ) -> impl Into>; + fn view(&self, state: &'a State) -> Element<'a, Message, Theme, Renderer>; } impl<'a, T, State, Message, Theme, Renderer, Widget> @@ -531,10 +517,7 @@ where State: 'static, Widget: Into>, { - fn view( - &self, - state: &'a State, - ) -> impl Into> { - self(state) + fn view(&self, state: &'a State) -> Element<'a, Message, Theme, Renderer> { + self(state).into() } } diff --git a/src/application/timed.rs b/src/application/timed.rs index e4a1d78f..606273c8 100644 --- a/src/application/timed.rs +++ b/src/application/timed.rs @@ -110,7 +110,6 @@ where ) -> Element<'a, Self::Message, Self::Theme, Self::Renderer> { self.view .view(state) - .into() .map(|message| (message, Instant::now())) } diff --git a/src/daemon.rs b/src/daemon.rs index 9336e941..8126e023 100644 --- a/src/daemon.rs +++ b/src/daemon.rs @@ -21,7 +21,7 @@ use std::borrow::Cow; pub fn daemon( boot: impl application::Boot, update: impl application::Update, - view: impl for<'a> self::View<'a, State, Message, Theme, Renderer>, + view: impl for<'a> View<'a, State, Message, Theme, Renderer>, ) -> Daemon> where State: 'static, @@ -286,7 +286,7 @@ pub trait View<'a, State, Message, Theme, Renderer> { &self, state: &'a State, window: window::Id, - ) -> impl Into>; + ) -> Element<'a, Message, Theme, Renderer>; } impl<'a, T, State, Message, Theme, Renderer, Widget> @@ -300,7 +300,7 @@ where &self, state: &'a State, window: window::Id, - ) -> impl Into> { - self(state, window) + ) -> Element<'a, Message, Theme, Renderer> { + self(state, window).into() } }