fn update_active_trip_points(&mut self, thermal_load: ThermalLoad, sensor: &str) {
        self.trip_point_states
            .iter_mut()
            .filter(|trip_point| trip_point.sensor == sensor)
            .for_each(|trip_point| {
                // For a trip point to be marked active, the thermal load must be at least greater
                // or equal to the `activate_at` threshold, OR the `deactivate_below` threshold if
                // the trip point is already active
                let activation_threshold = if trip_point.is_active {
                    trip_point.deactivate_below
                } else {
                    trip_point.activate_at
                };

                trip_point.is_active = thermal_load >= activation_threshold;
            });
    }
/// Updates the client's active trip points based on the new thermal load for the given sensor.
///
/// The function iterates through the vector of `TripPointState`s, filtering out those which do
/// not match the sensor whose thermal load has changed, and sets each `TripPointState` to be
/// active or inactive based on the new thermal load for the sensor.
Updates the client's active trip points based on the new thermal load for the given sensor.
The function iterates through the vector of `TripPointState`s, filtering out those which do
not match the sensor whose thermal load has changed, and sets each `TripPointState` to be
active or inactive based on the new thermal load for the sensor.
Updates the client ' s active trip points based on the new thermal load for the given sensor . The function iterates through the vector of ` TripPointState ` s filtering out those which do not match the sensor whose thermal load has changed and sets each ` TripPointState ` to be active or inactive based on the new thermal load for the sensor .
fn update_active_trip_points(&mut self, thermal_load: ThermalLoad, sensor: &str) {
        self.trip_point_states
            .iter_mut()
            .filter(|trip_point| trip_point.sensor == sensor)
            .for_each(|trip_point| {
                // For a trip point to be marked active, the thermal load must be at least greater
                // or equal to the `activate_at` threshold, OR the `deactivate_below` threshold if
                // the trip point is already active
                let activation_threshold = if trip_point.is_active {
                    trip_point.deactivate_below
                } else {
                    trip_point.activate_at
                };
                trip_point.is_active = thermal_load >= activation_threshold;
            });
    }
fn update_active_trip_points ( & mut self , thermal_load : ThermalLoad , sensor : & str ) { self . trip_point_states . iter_mut ( ) . filter ( | trip_point | trip_point . sensor == sensor ) . for_each ( | trip_point | { // For a trip point to be marked active, the thermal load must be at least greater // or equal to the `activate_at` threshold, OR the `deactivate_below` threshold if // the trip point is already active let activation_threshold = if trip_point . is_active { trip_point . deactivate_below } else { trip_point . activate_at } ; trip_point . is_active = thermal_load >= activation_threshold ; } ) ; }
Updates the client's active trip points based on the new thermal load for the given sensor.
Updates the client ' s active trip points based on the new thermal load for the given sensor .
&mut self
thermal_load
ThermalLoad
sensor
&str
&mut self
thermal_load
ThermalLoad
sensor
&str