fn check_power_level_maps<'a, K>(
current: Option<&'a [(K, Int)]>,
new: Option<&'a [(K, Int)]>,
sender_power_level: UserPowerLevel,
reject_current_power_level_change_fn: impl FnOnce(&K, Int) -> bool + Copy,
error_fn: impl FnOnce(&K) -> Error,
) -> Resultwhere
K: Ord,Expand description
Check the power levels changes between the current and the new maps.
ยงArguments
-
current: the map with the current power levels. -
new: the map with the new power levels. -
sender_power_level: the power level of the sender of the new map. -
reject_current_power_level_change_fn: the function to check if a power level change or removal must be rejected given its current value.The arguments to the method are the key of the power level and the current value of the power level. It must return
trueif the change or removal is rejected.Note that another check is done after this one to check if the change is allowed given the new value of the power level.
-
error_fn: the function to generate an error when the change for the given key is not allowed.