use crate::{adaptors::DefaultParseMode, requests::Requester, types::ParseMode};
#[cfg(feature = "cache_me")]
use crate::adaptors::CacheMe;
#[cfg(feature = "erased")]
use crate::adaptors::ErasedRequester;
#[cfg(feature = "trace_adaptor")]
use crate::adaptors::trace::{Settings, Trace};
#[cfg(feature = "throttle")]
use crate::adaptors::throttle::{Limits, Throttle};
pub trait RequesterExt: Requester {
#[cfg(feature = "cache_me")]
#[must_use]
fn cache_me(self) -> CacheMe<Self>
where
Self: Sized,
{
CacheMe::new(self)
}
#[cfg(feature = "erased")]
#[must_use]
fn erase<'a>(self) -> ErasedRequester<'a, Self::Err>
where
Self: 'a,
Self: Sized,
{
ErasedRequester::new(self)
}
#[cfg(feature = "trace_adaptor")]
#[must_use]
fn trace(self, settings: Settings) -> Trace<Self>
where
Self: Sized,
{
Trace::new(self, settings)
}
#[cfg(feature = "throttle")]
#[must_use]
fn throttle(self, limits: Limits) -> Throttle<Self>
where
Self: Sized + Clone + Send + Sync + 'static,
Self::Err: crate::errors::AsResponseParameters,
Self::GetChat: Send,
{
Throttle::new_spawn(self, limits)
}
#[must_use]
fn parse_mode(self, parse_mode: ParseMode) -> DefaultParseMode<Self>
where
Self: Sized,
{
DefaultParseMode::new(self, parse_mode)
}
}
impl<T> RequesterExt for T
where
T: Requester,
{
}