Function num::traits::clamp_max[][src]

pub fn clamp_max<T>(input: T, max: T) -> T where
    T: PartialOrd<T>, 

A value bounded by a maximum value

If input is greater than max then this returns max. Otherwise this returns input. clamp_max(std::f32::NAN, 1.0) preserves NAN different from f32::max(std::f32::NAN, 1.0).

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