pub enum RecoveryStrategy {
Backoff {
initial_ms: u64,
max_ms: u64,
multiplier: u32,
},
Retry {
delay_ms: u64,
max_attempts: u32,
},
RequestSnapshot,
Reauthenticate,
Fatal,
UserAction {
message: &'static str,
},
Skip,
Manual,
}Expand description
Recovery strategy for handling API errors
Variants§
Backoff
Exponential backoff before retry
Retry
Fixed delay retry
RequestSnapshot
Request a new snapshot (for orderbook desync)
Reauthenticate
Re-authenticate (token expired or invalid)
Fatal
Cannot recover programmatically - fatal error
UserAction
Requires user intervention (e.g., add funds)
Skip
Skip this message and continue
Manual
Manual investigation needed
Implementations§
Source§impl RecoveryStrategy
impl RecoveryStrategy
Sourcepub fn rate_limit_backoff() -> Self
pub fn rate_limit_backoff() -> Self
Default exponential backoff for rate limits
Sourcepub fn service_retry() -> Self
pub fn service_retry() -> Self
Default retry for transient service errors
Sourcepub fn initial_delay(&self) -> Option<Duration>
pub fn initial_delay(&self) -> Option<Duration>
Get the initial delay duration
Sourcepub fn allows_retry(&self) -> bool
pub fn allows_retry(&self) -> bool
Check if this strategy allows retry
Trait Implementations§
Source§impl Clone for RecoveryStrategy
impl Clone for RecoveryStrategy
Source§impl Debug for RecoveryStrategy
impl Debug for RecoveryStrategy
Source§impl Default for RecoveryStrategy
impl Default for RecoveryStrategy
Source§impl PartialEq for RecoveryStrategy
impl PartialEq for RecoveryStrategy
impl StructuralPartialEq for RecoveryStrategy
Auto Trait Implementations§
impl Freeze for RecoveryStrategy
impl RefUnwindSafe for RecoveryStrategy
impl Send for RecoveryStrategy
impl Sync for RecoveryStrategy
impl Unpin for RecoveryStrategy
impl UnsafeUnpin for RecoveryStrategy
impl UnwindSafe for RecoveryStrategy
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