Now let's take a silly one
0

Configure Feed

Select the types of activity you want to include in your feed.

at main 859 B View raw
1use std::num::{NonZeroU32, NonZeroU64}; 2use std::time::Duration; 3 4#[derive(Debug, Clone, Copy)] 5pub struct ListenLimits { 6 header_timeout: Duration, 7 idle_timeout: Duration, 8 max_connections: usize, 9} 10 11impl ListenLimits { 12 pub fn new( 13 header_timeout_ms: NonZeroU64, 14 idle_timeout_ms: NonZeroU64, 15 max_connections: NonZeroU32, 16 ) -> Self { 17 Self { 18 header_timeout: Duration::from_millis(header_timeout_ms.get()), 19 idle_timeout: Duration::from_millis(idle_timeout_ms.get()), 20 max_connections: max_connections.get() as usize, 21 } 22 } 23 24 pub fn header_timeout(&self) -> Duration { 25 self.header_timeout 26 } 27 28 pub fn idle_timeout(&self) -> Duration { 29 self.idle_timeout 30 } 31 32 pub fn max_connections(&self) -> usize { 33 self.max_connections 34 } 35}