pub trait CredentialProvider: DynClone + Debug + Sync + Send {
    fn get(&self, opts: GetOptions) -> IoResult<GotCredential>;

    fn async_get(
        &self,
        opts: GetOptions
    ) -> Pin<Box<dyn Future<Output = IoResult<GotCredential>> + Send + '_>> { ... } }
Expand description

认证信息获取接口

Required Methods§

返回七牛认证信息

该方法的异步版本为 Self::async_get

Provided Methods§

Available on crate feature async only.

异步返回七牛认证信息

Examples found in repository?
src/lib.rs (line 971)
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
    fn async_get(&self, opts: GetOptions) -> AsyncIoResult<'_, GotCredential> {
        Box::pin(async move {
            let mut last_err = None;
            for provider in self.credentials.iter() {
                match provider.async_get(opts).await {
                    Ok(cred) => {
                        return Ok(cred);
                    }
                    Err(err) => {
                        last_err = Some(err);
                    }
                }
            }
            Err(last_err.expect("No credential in ChainCredentialsProvider, which is unexpected"))
        })
    }

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Implementations on Foreign Types§

Available on crate feature async only.
Available on crate feature async only.
Available on crate feature async only.
Available on crate feature async only.
Available on crate feature async only.

Implementors§