fn validate(&self) -> Result<(), Error> {
        if self.p_states.len() == 0 {
            return Err(format_err!("Must have at least one P-state"));
        } else if self.p_states.len() > 1 {
            let mut last_power = get_cpu_power(
                self.capacitance,
                self.p_states[0].voltage,
                self.p_states[0].frequency,
            );
            for i in 1..self.p_states.len() {
                let p_state = &self.p_states[i];
                let power = get_cpu_power(self.capacitance, p_state.voltage, p_state.frequency);
                if power >= last_power {
                    return Err(format_err!(
                        "P-states must be in order of decreasing power consumption \
                         (violated by state {})",
                        i
                    ));
                }
                last_power = power;
            }
        }
        Ok(())
    }
/// Checks that the list of P-states is valid:
///  - Contains at least one element;
///  - Is in order of decreasing nominal power consumption.
Checks that the list of P-states is valid:
Contains at least one element;
Is in order of decreasing nominal power consumption.
Checks that the list of P - states is valid : Contains at least one element ; Is in order of decreasing nominal power consumption .
fn validate(&self) -> Result<(), Error> {
        if self.p_states.len() == 0 {
            return Err(format_err!("Must have at least one P-state"));
        } else if self.p_states.len() > 1 {
            let mut last_power = get_cpu_power(
                self.capacitance,
                self.p_states[0].voltage,
                self.p_states[0].frequency,
            );
            for i in 1..self.p_states.len() {
                let p_state = &self.p_states[i];
                let power = get_cpu_power(self.capacitance, p_state.voltage, p_state.frequency);
                if power >= last_power {
                    return Err(format_err!(
                        "P-states must be in order of decreasing power consumption \
                         (violated by state {})",
                        i
                    ));
                }
                last_power = power;
            }
        }
        Ok(())
    }
fn validate ( & self ) -> Result < ( ) , Error > { if self . p_states . len ( ) == 0 { return Err ( format_err ! ( " " ) ) ; } else if self . p_states . len ( ) > 1 { let mut last_power = get_cpu_power ( self . capacitance , self . p_states [ 0 ] . voltage , self . p_states [ 0 ] . frequency , ) ; for i in 1 .. self . p_states . len ( ) { let p_state = & self . p_states [ i ] ; let power = get_cpu_power ( self . capacitance , p_state . voltage , p_state . frequency ) ; if power >= last_power { return Err ( format_err ! ( " \
 " i ) ) ; } last_power = power ; } } Ok ( ( ) ) }
Checks that the list of P-states is valid:
 Contains at least one element;
 Is in order of decreasing nominal power consumption.
Checks that the list of P - states is valid : Contains at least one element ; Is in order of decreasing nominal power consumption .
&self