pub struct RotationPolicy {
pub requests_per_proxy: Option<NonZeroU64>,
pub max_age: Option<Duration>,
pub strategy: SelectionStrategy,
}Expand description
Limits controlling how long the pool retains its current proxy.
Each successful acquisition consumes one request allowance, including an acquisition whose eventual network request fails. When either enabled limit is reached, the next acquisition selects a replacement. Time limits are checked during acquisition; they do not schedule background work.
With both limits disabled, the current proxy is retained until it becomes unavailable or a caller requests a manual rotation. A replacement avoids the current proxy whenever another eligible proxy exists.
Fields§
§requests_per_proxy: Option<NonZeroU64>Maximum acquisitions per proxy selection; None disables this limit.
max_age: Option<Duration>Maximum elapsed time per selection; None disables this limit.
strategy: SelectionStrategyMethod used to choose the next eligible proxy.
Implementations§
Source§impl RotationPolicy
impl RotationPolicy
Sourcepub fn every(requests: NonZeroU64) -> Self
pub fn every(requests: NonZeroU64) -> Self
Keep each selection for this many acquisitions before rotating.
Sourcepub fn for_duration(duration: Duration) -> Result<Self>
pub fn for_duration(duration: Duration) -> Result<Self>
Keep each selection for a positive duration, regardless of request count. The time limit is checked on acquisition; no background timer is needed.
Trait Implementations§
Source§impl Clone for RotationPolicy
impl Clone for RotationPolicy
Source§fn clone(&self) -> RotationPolicy
fn clone(&self) -> RotationPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more