From ff2519b1d43d481987351a83b6dd7237524c21f0 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 27 Jul 2022 06:49:20 +0200 Subject: Replace stateful widgets with new `iced_pure` API --- src/application.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/application.rs') diff --git a/src/application.rs b/src/application.rs index aca97367..58d4a577 100644 --- a/src/application.rs +++ b/src/application.rs @@ -60,7 +60,8 @@ pub use iced_native::application::{Appearance, StyleSheet}; /// says "Hello, world!": /// /// ```no_run -/// use iced::{executor, Application, Command, Element, Settings, Text, Theme}; +/// use iced::executor; +/// use iced::{Application, Command, Element, Settings, Theme}; /// /// pub fn main() -> iced::Result { /// Hello::run(Settings::default()) @@ -86,8 +87,8 @@ pub use iced_native::application::{Appearance, StyleSheet}; /// Command::none() /// } /// -/// fn view(&mut self) -> Element { -/// Text::new("Hello, world!").into() +/// fn view(&self) -> Element { +/// "Hello, world!".into() /// } /// } /// ``` @@ -139,9 +140,7 @@ pub trait Application: Sized { /// Returns the widgets to display in the [`Application`]. /// /// These widgets can produce __messages__ based on user interaction. - fn view( - &mut self, - ) -> Element<'_, Self::Message, crate::Renderer>; + fn view(&self) -> Element<'_, Self::Message, crate::Renderer>; /// Returns the current [`Theme`] of the [`Application`]. /// @@ -249,7 +248,7 @@ where self.0.update(message) } - fn view(&mut self) -> Element<'_, Self::Message, Self::Renderer> { + fn view(&self) -> Element<'_, Self::Message, Self::Renderer> { self.0.view() } } -- cgit