summaryrefslogtreecommitdiffstats
path: root/examples/pokedex
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-16 05:33:47 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-16 05:33:47 +0100
commitc22269bff3085012d326a0df77bf27ad5bcb41b7 (patch)
tree1083f21d012ab2bac88fb51537d4dc431bc7f170 /examples/pokedex
parent0524e9b4571d264018656418f02a1f9e27e268d7 (diff)
downloadiced-c22269bff3085012d326a0df77bf27ad5bcb41b7.tar.gz
iced-c22269bff3085012d326a0df77bf27ad5bcb41b7.tar.bz2
iced-c22269bff3085012d326a0df77bf27ad5bcb41b7.zip
Introduce `Program` API
Diffstat (limited to 'examples/pokedex')
-rw-r--r--examples/pokedex/src/main.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/examples/pokedex/src/main.rs b/examples/pokedex/src/main.rs
index 193f85f2..099cc710 100644
--- a/examples/pokedex/src/main.rs
+++ b/examples/pokedex/src/main.rs
@@ -1,9 +1,11 @@
use iced::futures;
use iced::widget::{self, column, container, image, row, text};
-use iced::{Alignment, Application, Command, Element, Length, Settings, Theme};
+use iced::{Alignment, Command, Element, Length};
pub fn main() -> iced::Result {
- Pokedex::run(Settings::default())
+ iced::application(Pokedex::new, Pokedex::update, Pokedex::view)
+ .title(Pokedex::title)
+ .run()
}
#[derive(Debug)]
@@ -19,13 +21,8 @@ enum Message {
Search,
}
-impl Application for Pokedex {
- type Message = Message;
- type Theme = Theme;
- type Executor = iced::executor::Default;
- type Flags = ();
-
- fn new(_flags: ()) -> (Pokedex, Command<Message>) {
+impl Pokedex {
+ fn new() -> (Self, Command<Message>) {
(
Pokedex::Loading,
Command::perform(Pokemon::search(), Message::PokemonFound),