pub fn clamp<T>(n: T, start: T, end: T) -> T
where
    T: PartialOrd,
{
    if start <= end {
        if n < start {
            start
        } else if n > end {
            end
        } else {
            n
        }
    } else {
        if n < end {
            end
        } else if n > start {
            start
        } else {
            n
        }
    }
}
/// Clamp a value between some range.
Clamp a value between some range.
Clamp a value between some range .
pub fn clamp<T>(n: T, start: T, end: T) -> T
where
    T: PartialOrd,
{
    if start <= end {
        if n < start {
            start
        } else if n > end {
            end
        } else {
            n
        }
    } else {
        if n < end {
            end
        } else if n > start {
            start
        } else {
            n
        }
    }
}
pub fn clamp < T > ( n : T , start : T , end : T ) -> T where T : PartialOrd , { if start <= end { if n < start { start } else if n > end { end } else { n } } else { if n < end { end } else if n > start { start } else { n } } }
Clamp a value between some range.
Clamp a value between some range .
n
T
start
T
end
T
n
T
start
T
end
T