use crate::request_rate::target_rate::TargetRate;
use std::fmt;
use std::hash::{Hash, Hasher};
use stream_throttle::ThrottlePool;
#[derive(Clone)]
pub struct ApiRate {
pub target_rate: TargetRate,
pub throttle_pool: Option<ThrottlePool>,
}
impl std::default::Default for ApiRate {
fn default() -> Self {
Self {
target_rate: TargetRate::default(),
throttle_pool: None,
} } }
impl fmt::Debug for ApiRate {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("ApiRate")
.field("target_rate", &self.target_rate.to_string())
.finish_non_exhaustive()
}
}
impl PartialEq for ApiRate {
fn eq(&self, other: &Self) -> bool {
self.target_rate == other.target_rate }
}
impl Eq for ApiRate {}
impl Hash for ApiRate {
fn hash<H: Hasher>(&self, state: &mut H) {
self.target_rate.hash(state);
}
}