pacenotes_installer\engine/watcher.rs
1/// What the engine is doing, for the progress screen.
2#[derive(Clone, Copy, PartialEq, Eq, Debug)]
3pub enum Phase {
4 Checking,
5 Uninstalling,
6 BackingUp,
7 Installing,
8}
9
10/// Where a run is, and what happened, for the progress bar and the log.
11pub trait Watcher {
12 /// `done`/`total` are bytes across the whole phase, not per package.
13 fn phase(&mut self, phase: Phase, item: &str, done: u64, total: u64);
14 fn log(&mut self, line: &str);
15}
16
17/// A watcher that ignores everything.
18pub struct Silent;
19
20impl Watcher for Silent {
21 fn phase(&mut self, _: Phase, _: &str, _: u64, _: u64) {}
22 fn log(&mut self, _: &str) {}
23}