From 5e6222bf23952706073c9e99932c6ae9bcb8911f Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Mon, 25 Jul 2016 13:38:13 -0700 Subject: [PATCH] Use intermediate type for the callback promise Using actual promises would still be better --- src/view/progress_bar.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/view/progress_bar.rs b/src/view/progress_bar.rs index e29ef04..060ecc7 100644 --- a/src/view/progress_bar.rs +++ b/src/view/progress_bar.rs @@ -7,15 +7,19 @@ use event::*; use theme::ColorStyle; use view::View; +pub type CbPromise = Option>; + /// Display progress. pub struct ProgressBar { min: usize, max: usize, value: Arc, // TODO: use a Promise instead? - callback: Option>>>>, + callback: Option>>, } +new_default!(ProgressBar); + impl ProgressBar { /// Creates a new progress bar. /// @@ -43,7 +47,7 @@ impl ProgressBar { /// /// Whenever `callback` is set, it will be called on the next event loop. pub fn with_callback(mut self, - callback: Arc>>>) + callback: Arc>) -> Self { self.callback = Some(callback); self