diff options
author | 2022-07-27 06:49:20 +0200 | |
---|---|---|
committer | 2022-07-27 06:49:20 +0200 | |
commit | ff2519b1d43d481987351a83b6dd7237524c21f0 (patch) | |
tree | 5731eeb7eb1247d4a8951de0d5bc5d8102640559 /src/application.rs | |
parent | c44267b85f7aaa2997e3caf1323b837d95818c22 (diff) | |
download | iced-ff2519b1d43d481987351a83b6dd7237524c21f0.tar.gz iced-ff2519b1d43d481987351a83b6dd7237524c21f0.tar.bz2 iced-ff2519b1d43d481987351a83b6dd7237524c21f0.zip |
Replace stateful widgets with new `iced_pure` API
Diffstat (limited to 'src/application.rs')
-rw-r--r-- | src/application.rs | 13 |
1 files changed, 6 insertions, 7 deletions
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<Self::Message> { -/// Text::new("Hello, world!").into() +/// fn view(&self) -> Element<Self::Message> { +/// "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<Self::Theme>>; + fn view(&self) -> Element<'_, Self::Message, crate::Renderer<Self::Theme>>; /// 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() } } |