pub struct ClientConfig {
pub retry: RetryConfig,
pub rate_limit: RateLimitConfig,
pub operational_delays: OperationalDelayConfig,
pub api_key: Option<String>,
pub rate_limit_behavior: RateLimitBehavior,
}Expand description
Unified configuration for retry behavior and rate limiting
Fields§
§retry: RetryConfigRetry configuration
rate_limit: RateLimitConfigRate limit detection configuration
operational_delays: OperationalDelayConfigOperational delay configuration
api_key: Option<String>Last.fm API key for read-only API access (optional)
rate_limit_behavior: RateLimitBehaviorHow to react when a rate limit is detected (block-and-retry vs. return an error)
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn with_retries_disabled() -> Self
pub fn with_retries_disabled() -> Self
Create config with retries disabled
Sourcepub fn with_rate_limiting_disabled() -> Self
pub fn with_rate_limiting_disabled() -> Self
Create config with rate limit detection disabled
Sourcepub fn for_testing() -> Self
pub fn for_testing() -> Self
Create config optimized for testing (rate limit detection enabled, retries enabled but no delays)
Sourcepub fn with_retry_config(self, retry_config: RetryConfig) -> Self
pub fn with_retry_config(self, retry_config: RetryConfig) -> Self
Set custom retry configuration
Sourcepub fn with_rate_limit_config(self, rate_limit_config: RateLimitConfig) -> Self
pub fn with_rate_limit_config(self, rate_limit_config: RateLimitConfig) -> Self
Set custom rate limit configuration
Sourcepub fn with_operational_delays(
self,
operational_delays: OperationalDelayConfig,
) -> Self
pub fn with_operational_delays( self, operational_delays: OperationalDelayConfig, ) -> Self
Set custom operational delay configuration
Sourcepub fn with_max_retries(self, max_retries: u32) -> Self
pub fn with_max_retries(self, max_retries: u32) -> Self
Set custom retry count
Sourcepub fn with_retry_delays(self, base_delay: u64, max_delay: u64) -> Self
pub fn with_retry_delays(self, base_delay: u64, max_delay: u64) -> Self
Set custom retry delays
Sourcepub fn with_custom_rate_limit_patterns(self, patterns: Vec<String>) -> Self
pub fn with_custom_rate_limit_patterns(self, patterns: Vec<String>) -> Self
Add custom rate limit patterns
Sourcepub fn with_status_detection(self, enabled: bool) -> Self
pub fn with_status_detection(self, enabled: bool) -> Self
Enable/disable HTTP status code rate limit detection
Sourcepub fn with_pattern_detection(self, enabled: bool) -> Self
pub fn with_pattern_detection(self, enabled: bool) -> Self
Enable/disable response pattern rate limit detection
Sourcepub fn with_api_key(self, api_key: String) -> Self
pub fn with_api_key(self, api_key: String) -> Self
Set the Last.fm API key for read-only API access
Sourcepub fn with_rate_limit_behavior(self, behavior: RateLimitBehavior) -> Self
pub fn with_rate_limit_behavior(self, behavior: RateLimitBehavior) -> Self
Set how the client reacts to detected rate limits.
With RateLimitBehavior::ReturnError the client never sleeps or retries internally
on rate limits; operations surface LastFmError::RateLimit
so the caller can schedule retries itself (see RateLimitBehavior docs).
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ClientConfig
impl Debug for ClientConfig
Source§impl Default for ClientConfig
impl Default for ClientConfig
Source§fn default() -> ClientConfig
fn default() -> ClientConfig
impl Eq for ClientConfig
Source§impl PartialEq for ClientConfig
impl PartialEq for ClientConfig
impl StructuralPartialEq for ClientConfig
Auto Trait Implementations§
impl Freeze for ClientConfig
impl RefUnwindSafe for ClientConfig
impl Send for ClientConfig
impl Sync for ClientConfig
impl Unpin for ClientConfig
impl UnsafeUnpin for ClientConfig
impl UnwindSafe for ClientConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.