From b92e1f957408e3254e5fe0da389808474de6c4a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Mon, 23 Mar 2020 20:37:30 +0100 Subject: [PATCH] Rename `downloader` module to `download` --- .../src/{downloader.rs => download.rs} | 6 +++--- examples/download_progress/src/main.rs | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) rename examples/download_progress/src/{downloader.rs => download.rs} (95%) diff --git a/examples/download_progress/src/downloader.rs b/examples/download_progress/src/download.rs similarity index 95% rename from examples/download_progress/src/downloader.rs rename to examples/download_progress/src/download.rs index 3b54341e..0562f54d 100644 --- a/examples/download_progress/src/downloader.rs +++ b/examples/download_progress/src/download.rs @@ -2,17 +2,17 @@ use iced_futures::futures; // Just a little utility function pub fn file(url: T) -> iced::Subscription { - iced::Subscription::from_recipe(Downloader { + iced::Subscription::from_recipe(Download { url: url.to_string(), }) } -pub struct Downloader { +pub struct Download { url: String, } // Make sure iced can use our download stream -impl iced_native::subscription::Recipe for Downloader +impl iced_native::subscription::Recipe for Download where H: std::hash::Hasher, { diff --git a/examples/download_progress/src/main.rs b/examples/download_progress/src/main.rs index 75e3bee0..f3da3d7b 100644 --- a/examples/download_progress/src/main.rs +++ b/examples/download_progress/src/main.rs @@ -3,7 +3,7 @@ use iced::{ Element, Length, ProgressBar, Settings, Subscription, Text, }; -mod downloader; +mod download; pub fn main() { Example::run(Settings::default()) @@ -18,7 +18,7 @@ enum Example { #[derive(Debug, Clone)] pub enum Message { - DownloadProgressed(downloader::Progress), + DownloadProgressed(download::Progress), Download, } @@ -49,13 +49,13 @@ impl Application for Example { }, Message::DownloadProgressed(message) => match self { Example::Downloading { progress } => match message { - downloader::Progress::Started => { + download::Progress::Started => { *progress = 0.0; } - downloader::Progress::Advanced(percentage) => { + download::Progress::Advanced(percentage) => { *progress = percentage; } - downloader::Progress::Finished => { + download::Progress::Finished => { *self = Example::Finished { button: button::State::new(), } @@ -71,7 +71,7 @@ impl Application for Example { fn subscription(&self) -> Subscription { match self { Example::Downloading { .. } => { - downloader::file("https://speed.hetzner.de/100MB.bin") + download::file("https://speed.hetzner.de/100MB.bin") .map(Message::DownloadProgressed) } _ => Subscription::none(),