lucia 0.5.0

A flexible client API framework as well as a set of API collections
Documentation
use crate::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) -> crate::Result<Self> {
    Ok(Self { rc: RequestCounter::new()?, rl })
  }
}