pub struct CredentialEntry {
pub api_key: String,
pub base_url: Option<String>,
pub rate_limited_at: Option<Instant>,
pub cooldown: Duration,
pub failures: u32,
}Expand description
A single credential entry with health tracking.
Fields§
§api_key: String§base_url: Option<String>§rate_limited_at: Option<Instant>When this key was rate-limited. None if healthy.
cooldown: DurationHow long to wait before retrying this key.
failures: u32Number of consecutive failures.
Implementations§
Source§impl CredentialEntry
impl CredentialEntry
pub fn new(api_key: String, base_url: Option<String>) -> Self
Sourcepub fn is_available(&self) -> bool
pub fn is_available(&self) -> bool
Whether this credential is available (not in cooldown).
Sourcepub fn mark_rate_limited(&mut self, retry_after: Option<u64>)
pub fn mark_rate_limited(&mut self, retry_after: Option<u64>)
Mark this credential as rate-limited.
Sourcepub fn mark_success(&mut self)
pub fn mark_success(&mut self)
Mark this credential as successfully used.
Trait Implementations§
Source§impl Clone for CredentialEntry
impl Clone for CredentialEntry
Source§fn clone(&self) -> CredentialEntry
fn clone(&self) -> CredentialEntry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CredentialEntry
impl RefUnwindSafe for CredentialEntry
impl Send for CredentialEntry
impl Sync for CredentialEntry
impl Unpin for CredentialEntry
impl UnsafeUnpin for CredentialEntry
impl UnwindSafe for CredentialEntry
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