aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index bb0fc76..74d4be9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,6 +13,8 @@ use web_sys::*;
mod history;
mod ocr;
+use history::{History, NoETA};
+
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
@@ -110,7 +112,7 @@ async fn do_boot() {
let document = gloo::utils::document();
- let history = Rc::new(RefCell::new(history::History::default()));
+ let history = Rc::new(RefCell::new(History::default()));
let (manual_update_tx, manual_update_rx) = mpsc::channel::<()>(5);
@@ -252,7 +254,7 @@ async fn do_boot() {
history.record(queue_size);
let estimated_finish = history.completion_time();
let eta_text = match estimated_finish {
- Some(finish) => {
+ Ok(finish) => {
let empty_array = js_sys::Array::new();
let options = {
let kv_pair = js_sys::Array::new();
@@ -271,7 +273,10 @@ async fn do_boot() {
format.call1(&JsValue::UNDEFINED, &finish).unwrap();
locale_string.as_string().unwrap()
}
- None => format!("pending"),
+ Err(NoETA::Pending) => format!("pending"),
+ Err(NoETA::Fuck) => {
+ format!("fucked (try reloading i guess?)")
+ }
};
let label = format!(" - ETA {}", eta_text);
eta.set_inner_text(&label);