goose-http 0.1.0

HTTP/1.1 server for Rust implementing RFC 9110/9111/9112 semantics, caching, and range handling
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
//! Miscellaneous helpers shared across modules.

/// Clamp a value between lower and upper bounds.
pub fn clamp<T: Ord>(value: T, min: T, max: T) -> T {
    if value < min {
        min
    } else if value > max {
        max
    } else {
        value
    }
}