validate_and_clean_state

Function validate_and_clean_state 

Source
pub fn validate_and_clean_state<T>(
    state_data: &mut HashMap<String, T>,
    validator: impl Fn(&T) -> bool,
)
Expand description

Validates and cleans up state data by removing entries that don’t pass validation.

§Arguments

  • state_data - The state data to validate and clean
  • validator - Function that returns true for valid entries

§Type Parameters

  • T - The type of values in the state map

§Behavior

  • Retains only entries where validator returns true
  • In-place modification of the HashMap