#[non_exhaustive]pub struct RetryDirective {
pub should_retry: bool,
pub backoff: Option<Duration>,
pub proxy_kind: Option<ProxyKind>,
pub user_agent_profile: Option<String>,
pub session_action: SessionRetryAction,
}Expand description
Owned instructions returned by a RetryStrategy.
§Examples
use millipede_core::retry_strategy::{RetryDirective, SessionRetryAction};
use std::time::Duration;
let directive = RetryDirective::retry()
.backoff(Duration::from_secs(1))
.session_action(SessionRetryAction::Rotate);
assert!(directive.should_retry);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.should_retry: boolWhether the attempt should be retried.
backoff: Option<Duration>Delay before the next attempt.
proxy_kind: Option<ProxyKind>Proxy bucket for the next attempt.
user_agent_profile: Option<String>User-agent profile for the next attempt.
session_action: SessionRetryActionSession disposition for the retry.
Implementations§
Source§impl RetryDirective
impl RetryDirective
Sourcepub fn proxy_kind(self, proxy_kind: ProxyKind) -> Self
pub fn proxy_kind(self, proxy_kind: ProxyKind) -> Self
Sets the proxy bucket for the next attempt.
Sourcepub fn user_agent_profile(self, profile: impl Into<String>) -> Self
pub fn user_agent_profile(self, profile: impl Into<String>) -> Self
Sets the user-agent profile for the next attempt.
Sourcepub fn session_action(self, action: SessionRetryAction) -> Self
pub fn session_action(self, action: SessionRetryAction) -> Self
Sets the session disposition.
Trait Implementations§
Source§impl Clone for RetryDirective
impl Clone for RetryDirective
Source§fn clone(&self) -> RetryDirective
fn clone(&self) -> RetryDirective
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RetryDirective
impl Debug for RetryDirective
Source§impl Default for RetryDirective
impl Default for RetryDirective
Source§fn default() -> RetryDirective
fn default() -> RetryDirective
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RetryDirective
impl RefUnwindSafe for RetryDirective
impl Send for RetryDirective
impl Sync for RetryDirective
impl Unpin for RetryDirective
impl UnsafeUnpin for RetryDirective
impl UnwindSafe for RetryDirective
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
Mutably borrows from an owned value. Read more