at-jet 0.7.2

High-performance HTTP + Protobuf API framework for mobile services
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Request timeout middleware

use {std::time::Duration,
     tower_http::timeout::TimeoutLayer as TowerTimeoutLayer};

/// Re-export tower-http's TimeoutLayer for convenience
pub type TimeoutLayer = TowerTimeoutLayer;

/// Create a timeout layer with the specified duration
pub fn timeout(duration: Duration) -> TimeoutLayer {
  TimeoutLayer::new(duration)
}

/// Create a timeout layer with seconds
pub fn timeout_secs(secs: u64) -> TimeoutLayer {
  TimeoutLayer::new(Duration::from_secs(secs))
}