aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/background/worker.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/util/background/worker.rs b/src/util/background/worker.rs
index c08a0aaa..7fd63c2b 100644
--- a/src/util/background/worker.rs
+++ b/src/util/background/worker.rs
@@ -15,7 +15,7 @@ use crate::background::WorkerInfo;
use crate::error::Error;
use crate::time::now_msec;
-#[derive(PartialEq, Copy, Clone, Debug, Serialize, Deserialize)]
+#[derive(PartialEq, Copy, Clone, Serialize, Deserialize, Debug)]
pub enum WorkerStatus {
Busy,
Throttled(f32),
@@ -23,6 +23,17 @@ pub enum WorkerStatus {
Done,
}
+impl std::fmt::Display for WorkerStatus {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
+ WorkerStatus::Busy => write!(f, "Busy"),
+ WorkerStatus::Throttled(t) => write!(f, "Thr:{:.3}", t),
+ WorkerStatus::Idle => write!(f, "Idle"),
+ WorkerStatus::Done => write!(f, "Done"),
+ }
+ }
+}
+
#[async_trait]
pub trait Worker: Send {
fn name(&self) -> String;