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/scroll.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'examples/scroll.rs') diff --git a/examples/scroll.rs b/examples/scroll.rs index 50701879..61ad2a53 100644 --- a/examples/scroll.rs +++ b/examples/scroll.rs @@ -1,12 +1,12 @@ use iced::{ - button, scrollable, Align, Application, Button, Container, Element, Image, - Length, Scrollable, Text, + button, scrollable, Align, Application, Button, Command, Container, + Element, Image, Length, Scrollable, Text, }; pub fn main() { env_logger::init(); - Example::default().run() + Example::run() } #[derive(Default)] @@ -25,16 +25,22 @@ pub enum Message { impl Application for Example { type Message = Message; + fn new() -> (Example, Command) { + (Example::default(), Command::none()) + } + fn title(&self) -> String { String::from("Scroll - Iced") } - fn update(&mut self, message: Message) { + fn update(&mut self, message: Message) -> Command { match message { Message::AddItem => { self.item_count += 1; } } + + Command::none() } fn view(&mut self) -> Element { -- cgit