#[non_exhaustive]pub enum RetryDirective {
Stop,
Retry {
backoff_ms: u64,
},
Escalate {
reason: EscalationReason,
},
}Expand description
What the dispatcher does next, returned by RetryPolicy::decide.
§Examples
let stop = RetryDirective::Stop;
let retry = RetryDirective::Retry { backoff_ms: 1000 };
let escalate = RetryDirective::Escalate {
reason: EscalationReason::SoftBlock,
};
match escalate {
RetryDirective::Stop => println!("Stop"),
RetryDirective::Retry { backoff_ms } => println!("Wait {}ms", backoff_ms),
RetryDirective::Escalate { reason } => println!("Escalate: {:?}", reason),
// `#[non_exhaustive]`: callers outside the crate must include a wildcard
// so future variants do not break their match.
_ => println!("other directive"),
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Stop
Stop. Surface the current result to the caller.
Retry
Retry the same tier after backoff_ms. Use for rate-limit / 5xx.
Escalate
Escalate to the next tier per EscalationStrategy.
Fields
§
reason: EscalationReasonReason for escalation, used for metrics and logging.
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 PartialEq for RetryDirective
impl PartialEq for RetryDirective
Source§fn eq(&self, other: &RetryDirective) -> bool
fn eq(&self, other: &RetryDirective) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RetryDirective
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