pub fn clamp<T>(val: T, min: T, max: T) -> Twhere
T: PartialOrd,
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
.