1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use crate::progress::{MessageLevel, Progress};

use prodash::tree::{Item, MessageLevel as TreeMessageLevel};

impl Progress for Item {
    type SubProgress = Item;

    fn add_child(&mut self, name: impl Into<String>) -> Self::SubProgress {
        Item::add_child(self, name)
    }

    fn init(&mut self, max: Option<u32>, unit: Option<&'static str>) {
        Item::init(self, max, unit)
    }

    fn set(&mut self, step: u32) {
        Item::set(self, step)
    }

    fn inc_by(&mut self, step: u32) {
        self.inc_by(step)
    }

    fn message(&mut self, level: MessageLevel, message: impl Into<String>) {
        Item::message(
            self,
            match level {
                MessageLevel::Success => TreeMessageLevel::Success,
                MessageLevel::Failure => TreeMessageLevel::Failure,
                MessageLevel::Info => TreeMessageLevel::Info,
            },
            message,
        )
    }
}