Adding documentation comments
This commit is contained in:
parent
07ff5b62b9
commit
a5445b7619
|
@ -109,7 +109,10 @@ pub mod traits {
|
||||||
pub mod rational {
|
pub mod rational {
|
||||||
pub use num_rational::*;
|
pub use num_rational::*;
|
||||||
}
|
}
|
||||||
|
/// A value bounded by a minimum and a maximum
|
||||||
|
///
|
||||||
|
/// If input is less than min then min is returned, if input is greater than max then max is
|
||||||
|
/// returned. Otherwise input is returned.
|
||||||
pub fn clamp<T: PartialOrd + Copy>(input: T, min: T, max: T) -> T {
|
pub fn clamp<T: PartialOrd + Copy>(input: T, min: T, max: T) -> T {
|
||||||
debug_assert!(min < max, "min must be less than max");
|
debug_assert!(min < max, "min must be less than max");
|
||||||
if input <= min {min}
|
if input <= min {min}
|
||||||
|
|
Loading…
Reference in New Issue