Introduce Program API

This commit is contained in:
Héctor Ramón Jiménez 2024-03-16 05:33:47 +01:00
parent 0524e9b457
commit c22269bff3
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
43 changed files with 1141 additions and 831 deletions

View file

@ -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),