diff options
author | 2025-02-11 02:34:10 +0100 | |
---|---|---|
committer | 2025-02-11 02:34:10 +0100 | |
commit | 9f21eae1528fa414adbfb987ce4c851fa58326fe (patch) | |
tree | 4eff76cd5effe1b3fa51e4fe17c9a53aa9823841 /examples/gallery/src/main.rs | |
parent | 06ece6a8c30541b7b2b6bcbb370fdffc9f1fcb79 (diff) | |
download | iced-9f21eae1528fa414adbfb987ce4c851fa58326fe.tar.gz iced-9f21eae1528fa414adbfb987ce4c851fa58326fe.tar.bz2 iced-9f21eae1528fa414adbfb987ce4c851fa58326fe.zip |
Introduce `Task::map_with`
Diffstat (limited to '')
-rw-r--r-- | examples/gallery/src/main.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/examples/gallery/src/main.rs b/examples/gallery/src/main.rs index ab22679d..441ad924 100644 --- a/examples/gallery/src/main.rs +++ b/examples/gallery/src/main.rs @@ -94,17 +94,15 @@ impl Gallery { return Task::none(); }; - Task::batch(vec![ - Task::perform( + Task::batch([ + Task::future( image.clone().blurhash(Preview::WIDTH, Preview::HEIGHT), - move |result| Message::BlurhashDecoded(id, result), - ), - Task::perform( - image.download(Size::Thumbnail { - width: Preview::WIDTH, - }), - move |result| Message::ThumbnailDownloaded(id, result), - ), + ) + .map_with(id, Message::BlurhashDecoded), + Task::future(image.download(Size::Thumbnail { + width: Preview::WIDTH, + })) + .map_with(id, Message::ThumbnailDownloaded), ]) } Message::ImageDownloaded(Ok(rgba)) => { |