summaryrefslogtreecommitdiffstats
path: root/src/application.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2022-08-06 00:32:57 +0200
committerLibravatar GitHub <noreply@github.com>2022-08-06 00:32:57 +0200
commit1923dbf7f0769d55e5283f572fde0ce752e28b86 (patch)
tree7be9b36f941f6e13ddc8884f715c04555b1e77db /src/application.rs
parent1b4f38c71f6e05e26599ee75ea9c91dde96e71ae (diff)
parentc23ed7e4a0a2b62a0d7cabe6e35d7323eac543d2 (diff)
downloadiced-1923dbf7f0769d55e5283f572fde0ce752e28b86.tar.gz
iced-1923dbf7f0769d55e5283f572fde0ce752e28b86.tar.bz2
iced-1923dbf7f0769d55e5283f572fde0ce752e28b86.zip
Merge pull request #1393 from iced-rs/deprecate-stateful-widgets
Replace stateful widgets with the new `iced_pure` API
Diffstat (limited to 'src/application.rs')
-rw-r--r--src/application.rs13
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()
}
}