wtx 0.28.0

A collection of different transport implementations and related tools focused primarily on web technologies.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::client_api_framework::misc::{RequestCounter, RequestLimit};

/// A wrapper around [RequestCounter] and [RequestLimit].
#[derive(Clone, Copy, Debug)]
pub struct RequestThrottling {
  /// See [RequestCounter]
  pub rc: RequestCounter,
  /// See [RequestLimit]
  pub rl: RequestLimit,
}

impl RequestThrottling {
  /// Creates an instance with default [RequestCounter] values.
  #[inline]
  pub fn from_rl(rl: RequestLimit) -> Self {
    Self { rc: RequestCounter::new(), rl }
  }
}