pub struct RetryInfo {
pub attempts: u32,
pub max_attempts: u32,
pub retry_after_ms: Option<u64>,
}Expand description
Information about retry attempts
This type is used to track retry state for operations that may need multiple attempts. It includes the number of attempts made, the maximum allowed, and an optional delay before the next retry.
§Example
use turbomcp_protocol::error::RetryInfo;
let retry_info = RetryInfo {
attempts: 2,
max_attempts: 5,
retry_after_ms: Some(1000),
};
assert!(!retry_info.exhausted());Fields§
§attempts: u32Number of attempts made so far
max_attempts: u32Maximum attempts allowed before giving up
retry_after_ms: Option<u64>Suggested delay in milliseconds before the next retry attempt
Implementations§
Source§impl RetryInfo
impl RetryInfo
Sourcepub const fn with_delay(max_attempts: u32, retry_after_ms: u64) -> Self
pub const fn with_delay(max_attempts: u32, retry_after_ms: u64) -> Self
Create retry info with a specific delay
§Arguments
max_attempts- Maximum number of retry attempts allowedretry_after_ms- Delay in milliseconds before next retry
§Example
use turbomcp_protocol::error::RetryInfo;
let retry_info = RetryInfo::with_delay(3, 1000);
assert_eq!(retry_info.retry_after_ms, Some(1000));Sourcepub const fn exhausted(&self) -> bool
pub const fn exhausted(&self) -> bool
Check if retry attempts are exhausted
§Example
use turbomcp_protocol::error::RetryInfo;
let mut retry_info = RetryInfo::new(2);
assert!(!retry_info.exhausted());
retry_info.attempts = 2;
assert!(retry_info.exhausted());Trait Implementations§
Source§impl<'de> Deserialize<'de> for RetryInfo
impl<'de> Deserialize<'de> for RetryInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for RetryInfo
impl StructuralPartialEq for RetryInfo
Auto Trait Implementations§
impl Freeze for RetryInfo
impl RefUnwindSafe for RetryInfo
impl Send for RetryInfo
impl Sync for RetryInfo
impl Unpin for RetryInfo
impl UnsafeUnpin for RetryInfo
impl UnwindSafe for RetryInfo
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
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.