summaryrefslogtreecommitdiffstats
path: root/examples/exit/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-03-16 17:09:00 +0100
committerLibravatar GitHub <noreply@github.com>2024-03-16 17:09:00 +0100
commit503a48e89977437bf8b7bf485f416a15a2e83ed0 (patch)
tree30306bbaee7a31090ace9d7725d46c2c0027fe6b /examples/exit/src
parent0524e9b4571d264018656418f02a1f9e27e268d7 (diff)
parentcfc0383bbfff083786840e3f1fd499e5991fa629 (diff)
downloadiced-503a48e89977437bf8b7bf485f416a15a2e83ed0.tar.gz
iced-503a48e89977437bf8b7bf485f416a15a2e83ed0.tar.bz2
iced-503a48e89977437bf8b7bf485f416a15a2e83ed0.zip
Merge pull request #2331 from iced-rs/program-api
`Program` API
Diffstat (limited to 'examples/exit/src')
-rw-r--r--examples/exit/src/main.rs20
1 files changed, 3 insertions, 17 deletions
diff --git a/examples/exit/src/main.rs b/examples/exit/src/main.rs
index ec618dc1..4948bd0f 100644
--- a/examples/exit/src/main.rs
+++ b/examples/exit/src/main.rs
@@ -1,10 +1,9 @@
-use iced::executor;
use iced::widget::{button, column, container};
use iced::window;
-use iced::{Alignment, Application, Command, Element, Length, Settings, Theme};
+use iced::{Alignment, Command, Element, Length};
pub fn main() -> iced::Result {
- Exit::run(Settings::default())
+ iced::application("Exit - Iced", Exit::update, Exit::view).run()
}
#[derive(Default)]
@@ -18,20 +17,7 @@ enum Message {
Exit,
}
-impl Application for Exit {
- type Executor = executor::Default;
- type Message = Message;
- type Theme = Theme;
- type Flags = ();
-
- fn new(_flags: ()) -> (Self, Command<Message>) {
- (Self::default(), Command::none())
- }
-
- fn title(&self) -> String {
- String::from("Exit - Iced")
- }
-
+impl Exit {
fn update(&mut self, message: Message) -> Command<Message> {
match message {
Message::Confirm => window::close(window::Id::MAIN),