1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
// 
// Sysinfo
// 
// Copyright (c) 2015 Guillaume Gomez
//

use std::fmt::{Debug, Error, Formatter};
use sys::Component;

impl Debug for Component {
    fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
        if let Some(critical) = self.critical {
            write!(f, "{}: {}°C (max: {}°C / critical: {}°C)",
                   self.label, self.temperature, self.max, critical)
        } else {
            write!(f, "{}: {}°C (max: {}°C)",
                   self.label, self.temperature, self.max)
        }
    }
}