pub fn clamp<T: PartialOrd>(val: T, min: T, max: T) -> T
Expand description
Returns a reference to the input value clamped to the interval [min, max]
.
In particular:
* If min < val < max
, this returns val
.
* If val <= min
, this returns min
.
* If val >= max
, this returns max
.