summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/download_progress/src/main.rs2
-rw-r--r--examples/gallery/src/main.rs18
2 files changed, 9 insertions, 11 deletions
diff --git a/examples/download_progress/src/main.rs b/examples/download_progress/src/main.rs
index 8f59f1dc..cc7a7800 100644
--- a/examples/download_progress/src/main.rs
+++ b/examples/download_progress/src/main.rs
@@ -52,7 +52,7 @@ impl Example {
let task = download.start();
- task.map(move |update| Message::DownloadUpdated(index, update))
+ task.map_with(index, Message::DownloadUpdated)
}
Message::DownloadUpdated(id, update) => {
if let Some(download) =
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)) => {