From 02c20e6202f1c8c28753f3233cc635790707937a Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 17 Nov 2019 07:09:46 +0100 Subject: Support async actions in `iced_winit` --- examples/todos.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'examples/todos.rs') diff --git a/examples/todos.rs b/examples/todos.rs index f921a666..d97a9e08 100644 --- a/examples/todos.rs +++ b/examples/todos.rs @@ -1,11 +1,11 @@ use iced::{ button, scrollable, text::HorizontalAlignment, text_input, Align, - Application, Background, Button, Checkbox, Color, Column, Container, - Element, Font, Length, Row, Scrollable, Text, TextInput, + Application, Background, Button, Checkbox, Color, Column, Command, + Container, Element, Font, Length, Row, Scrollable, Text, TextInput, }; pub fn main() { - Todos::default().run() + Todos::run() } #[derive(Debug, Default)] @@ -29,11 +29,15 @@ pub enum Message { impl Application for Todos { type Message = Message; + fn new() -> (Todos, Command) { + (Todos::default(), Command::none()) + } + fn title(&self) -> String { String::from("Todos - Iced") } - fn update(&mut self, message: Message) { + fn update(&mut self, message: Message) -> Command { match message { Message::InputChanged(value) => { self.input_value = value; @@ -58,6 +62,8 @@ impl Application for Todos { } dbg!(self); + + Command::none() } fn view(&mut self) -> Element { -- cgit