pub struct StaticCredentialProvider { /* private fields */ }Expand description
Reference implementation of CredentialProvider that always returns a fixed key.
Useful for tests and for wiring a ModelConfig uniformly when refresh is not
needed — equivalent to leaving ModelConfig::credentials = None and relying on
the static api_key field, but lets test harnesses count invalidate() calls.
Implementations§
Trait Implementations§
Source§impl Clone for StaticCredentialProvider
impl Clone for StaticCredentialProvider
Source§fn clone(&self) -> StaticCredentialProvider
fn clone(&self) -> StaticCredentialProvider
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 CredentialProvider for StaticCredentialProvider
impl CredentialProvider for StaticCredentialProvider
Source§fn current<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn current<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return the current API key for this credential. Implementations may cache,
re-fetch from a metadata service, or compute on the fly. Called once per
StreamProvider::stream() invocation.Source§fn invalidate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn invalidate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Hint that the current cached credential has been rejected by the upstream
API and a fresh value should be fetched on the next
current() call. Read moreAuto Trait Implementations§
impl Freeze for StaticCredentialProvider
impl RefUnwindSafe for StaticCredentialProvider
impl Send for StaticCredentialProvider
impl Sync for StaticCredentialProvider
impl Unpin for StaticCredentialProvider
impl UnsafeUnpin for StaticCredentialProvider
impl UnwindSafe for StaticCredentialProvider
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