pub struct CredentialProvider { /* private fields */ }Expand description
Fetches credentials for one attempt, typically from your own credential endpoint.
The SDK drops the provider’s future when the attempt’s deadline passes or
the channel closes, and discards anything that it would return afterwards.
An error or a panic is reported as CelerisError::Transport; the SDK
never inspects or passes on its detail.
Implementations§
Source§impl CredentialProvider
impl CredentialProvider
Sourcepub fn new<Provide, Provided>(provide: Provide) -> CredentialProviderwhere
Provide: Fn(CredentialRequest) -> Provided + Send + Sync + 'static,
Provided: Future<Output = Result<Credentials, ProviderError>> + Send + 'static,
pub fn new<Provide, Provided>(provide: Provide) -> CredentialProviderwhere
Provide: Fn(CredentialRequest) -> Provided + Send + Sync + 'static,
Provided: Future<Output = Result<Credentials, ProviderError>> + Send + 'static,
Wraps an async function or closure:
use useceleris_client::{CredentialProvider, Credentials};
let provider = CredentialProvider::new(|_request| async {
// Fetch these from your own credential endpoint.
Ok(Credentials {
payload: "payload".to_owned(),
signature: "signature".to_owned(),
})
});Sourcepub fn provide(&self, request: CredentialRequest) -> CredentialFuture
pub fn provide(&self, request: CredentialRequest) -> CredentialFuture
Calls the provider.
Trait Implementations§
Source§impl Clone for CredentialProvider
impl Clone for CredentialProvider
Auto Trait Implementations§
impl !RefUnwindSafe for CredentialProvider
impl !UnwindSafe for CredentialProvider
impl Freeze for CredentialProvider
impl Send for CredentialProvider
impl Sync for CredentialProvider
impl Unpin for CredentialProvider
impl UnsafeUnpin for CredentialProvider
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