fn from_line(line: &str) -> Result<Calculations> {
        assert!(line.starts_with("cpu"));

        let usages = line
            .split(' ')
            .skip(1)
            .filter(|part| part.len() > 0)
            .map(|part| part.parse())
            .collect::<StdResult<Vec<u64>, _>>()?;
        Ok(Calculations {
            user: Jiffies::new(usages[0]),
            nice: Jiffies::new(usages[1]),
            system: Jiffies::new(usages[2]),
            idle: Jiffies::new(usages[3]),
            iowait: Jiffies::new(usages[4]),
            irq: Jiffies::new(usages[5]),
            softirq: Jiffies::new(usages[6]),
            steal: Jiffies::new(usages[7]),
            guest: Jiffies::new(usages[8]),
            guest_nice: usages.get(9).map(|v| Jiffies::new(*v)),
        })
    }
/// Convert a single line from /proc/stat
Convert a single line from /proc/stat
Convert a single line from / proc / stat
fn from_line(line: &str) -> Result<Calculations> {
        assert!(line.starts_with("cpu"));
        let usages = line
            .split(' ')
            .skip(1)
            .filter(|part| part.len() > 0)
            .map(|part| part.parse())
            .collect::<StdResult<Vec<u64>, _>>()?;
        Ok(Calculations {
            user: Jiffies::new(usages[0]),
            nice: Jiffies::new(usages[1]),
            system: Jiffies::new(usages[2]),
            idle: Jiffies::new(usages[3]),
            iowait: Jiffies::new(usages[4]),
            irq: Jiffies::new(usages[5]),
            softirq: Jiffies::new(usages[6]),
            steal: Jiffies::new(usages[7]),
            guest: Jiffies::new(usages[8]),
            guest_nice: usages.get(9).map(|v| Jiffies::new(*v)),
        })
    }
fn from_line ( line : & str ) -> Result < Calculations > { assert ! ( line starts_with ( " " ) ) ; let usages = line . split ( ' ' ) . skip ( 1 ) . filter ( | part | part . len ( ) > 0 ) . map ( | part | part . parse ( ) ) . collect :: < StdResult < Vec < u64 > , _ > > ( ) ? ; Ok ( Calculations { user : Jiffies :: new ( usages [ 0 ] ) , nice : Jiffies :: new ( usages [ 1 ] ) , system : Jiffies :: new ( usages [ 2 ] ) , idle : Jiffies :: new ( usages [ 3 ] ) , iowait : Jiffies :: new ( usages [ 4 ] ) , irq : Jiffies :: new ( usages [ 5 ] ) , softirq : Jiffies :: new ( usages [ 6 ] ) , steal : Jiffies :: new ( usages [ 7 ] ) , guest : Jiffies :: new ( usages [ 8 ] ) , guest_nice : usages . get ( 9 ) . map ( | v | Jiffies :: new ( * v ) ) , } ) }
Convert a single line from /proc/stat
Convert a single line from / proc / stat
line
&str
line
&str