usagi 0.2.0

Common algorithms and utilities library for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Math utilities

pub fn clamp
  < T: PartialOrd >
  ( value: T, min: T, max: T )
  -> T
{
  if value <= min
  { min }
  else if value >= max
  { max }
  else
  { value }
}