diff options
author | 2019-11-18 23:06:28 +0100 | |
---|---|---|
committer | 2019-11-18 23:06:28 +0100 | |
commit | 5adefdf6613bfe0738b573eab1d280fa041f5417 (patch) | |
tree | 60ff05b3ee9e896d9538de19bb2412c7d6e63c6a /examples/scroll.rs | |
parent | 54ffefcc0b8f4558a93ca51f044594db009bacc8 (diff) | |
parent | 63dbf078fefea444073813e834c2d35fa25eb3a7 (diff) | |
download | iced-5adefdf6613bfe0738b573eab1d280fa041f5417.tar.gz iced-5adefdf6613bfe0738b573eab1d280fa041f5417.tar.bz2 iced-5adefdf6613bfe0738b573eab1d280fa041f5417.zip |
Merge pull request #62 from hecrj/feature/async-actions
Async actions
Diffstat (limited to 'examples/scroll.rs')
-rw-r--r-- | examples/scroll.rs | 14 |
1 files changed, 10 insertions, 4 deletions
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<Message>) { + (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<Message> { match message { Message::AddItem => { self.item_count += 1; } } + + Command::none() } fn view(&mut self) -> Element<Message> { |