Function Subspace :: sus :: cmp :: clamp
Restrict a value to a certain interval.
Returns max
if v
is greater than max
, and min
if v
is less than
min
. Otherwise this returns v
.
By default this receives and returns objects by value. To receive and return
references, specify the type parameter, such as:
sus::cmp::clamp<i32&>(a, min, max)
. Note that if any input is a temporary
object this can return a reference to an object past its lifetime.
Panics
Panics if min > max
.