pub trait UploadTokenProvider: DynClone + Debug + Sync + Send {
    fn access_key(&self, opts: GetAccessKeyOptions) -> ParseResult<GotAccessKey>;
    fn policy(&self, opts: GetPolicyOptions) -> ParseResult<GotUploadPolicy<'_>>;
    fn to_token_string(
        &self,
        opts: ToStringOptions
    ) -> ToStringResult<Cow<'_, str>>; fn async_access_key(
        &self,
        opts: GetAccessKeyOptions
    ) -> Pin<Box<dyn Future<Output = ParseResult<GotAccessKey>> + Send + '_>> { ... } fn async_policy(
        &self,
        opts: GetPolicyOptions
    ) -> Pin<Box<dyn Future<Output = ParseResult<GotUploadPolicy<'_>>> + Send + '_>> { ... } fn async_to_token_string(
        &self,
        opts: ToStringOptions
    ) -> Pin<Box<dyn Future<Output = ToStringResult<Cow<'_, str>>> + Send + '_>> { ... } }
Expand description

上传凭证获取接口

可以阅读 https://developer.qiniu.com/kodo/manual/1208/upload-token 了解七牛安全机制。

Required Methods§

从上传凭证内获取 AccessKey

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

从上传凭证内获取上传策略

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

生成字符串

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

Provided Methods§

Available on crate feature async only.

异步从上传凭证内获取 AccessKey

Available on crate feature async only.

异步从上传凭证内获取上传策略

Examples found in repository?
src/upload_token.rs (line 245)
243
244
245
246
247
248
249
250
251
252
253
    fn async_bucket_name(&self, opts: GetPolicyOptions) -> AsyncParseResult<'_, BucketName> {
        Box::pin(async move {
            self.async_policy(opts).await.and_then(|policy| {
                policy
                    .bucket()
                    .map_or(Err(ParseError::InvalidUploadTokenFormat), |bucket_name| {
                        Ok(BucketName::from(bucket_name))
                    })
            })
        })
    }
Available on crate feature async only.

异步生成字符串

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.
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.
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§