Introduce Program API
This commit is contained in:
parent
0524e9b457
commit
c22269bff3
43 changed files with 1141 additions and 831 deletions
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue