num::traits

Function clamp_min

Source
pub fn clamp_min<T>(input: T, min: T) -> T
where T: PartialOrd,
Expand description

A value bounded by a minimum value

If input is less than min then this returns min. Otherwise this returns input. clamp_min(std::f32::NAN, 1.0) preserves NAN different from f32::min(std::f32::NAN, 1.0).

Panics in debug mode if !(min == min). (This occurs if min is NAN.)