pid_control 0.7.2

A PID controller library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Utility module.
//!
//! Contains small functions not related to the core functionality, but still
//! exposed because they might be useful elsewhere.

/// Caps a value inside a certain range.
#[inline]
pub fn limit_range<T>(min: T, max: T, value: T) -> T
where T: PartialOrd {
    if value > max {
        max
    }
    else if value < min {
        min
    } else {
        value
    }
}