pub fn check_threshold<F: Fn() -> T, H: ThresholdFor<T>, T>( f: F, ref_value: &T, threshold: H, ) -> Result<T, H::Error>