pub fn new(config: Config) -> Option<Self> {
        let bucket_ms = Duration::from_millis(config.bucket_size_in_ms);
        let window_size = bucket_ms.checked_mul(config.buckets_in_window);

        window_size.map(|window_size| Window {
            bucket_ms,
            window_size,
            buckets: VecDeque::new(),
            buckets_nr: config.buckets_in_window,
        })
    }
/// Attempt to create a window from a given configuration. Returns
/// `None` if the duration calculations overflowed.
Attempt to create a window from a given configuration. Returns
`None` if the duration calculations overflowed.
Attempt to create a window from a given configuration . Returns ` None ` if the duration calculations overflowed .
pub fn new(config: Config) -> Option<Self> {
        let bucket_ms = Duration::from_millis(config.bucket_size_in_ms);
        let window_size = bucket_ms.checked_mul(config.buckets_in_window);
        window_size.map(|window_size| Window {
            bucket_ms,
            window_size,
            buckets: VecDeque::new(),
            buckets_nr: config.buckets_in_window,
        })
    }
pub fn new ( config : Config ) -> Option < Self > { let bucket_ms = Duration :: from_millis ( config . bucket_size_in_ms ) ; let window_size = bucket_ms . checked_mul ( config . buckets_in_window ) ; window_size . map ( | window_size | Window { bucket_ms , window_size , buckets : VecDeque :: new ( ) , buckets_nr : config . buckets_in_window , } ) }
Attempt to create a window from a given configuration.
Attempt to create a window from a given configuration .
config
Config