Progressbar (#25)

* Progressbar
* header
* label
* border
This commit is contained in:
Jens K.
2024-12-25 12:21:36 +01:00
committed by GitHub
parent acb627b1d7
commit ae1a48e5e8
6 changed files with 96 additions and 8 deletions

View File

@@ -393,12 +393,22 @@ impl Clock<Countdown> {
}
}
pub fn set_done(&mut self) {
fn set_done(&mut self) {
if self.current_value.is_zero() {
self.mode = Mode::Done;
}
}
pub fn get_percentage_done(&self) -> u16 {
let initial = self.initial_value.as_millis();
let elapsed = self
.initial_value
.saturating_sub(self.current_value)
.as_millis();
(elapsed * 100 / initial) as u16
}
pub fn edit_next(&mut self) {
self.edit_mode_next();
}