Trait UploadTokenProvider

Source
pub trait UploadTokenProvider:
    DynClone
    + Debug
    + Sync
    + Send {
    // Required methods
    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>>;

    // Provided methods
    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§

Source

fn access_key(&self, opts: GetAccessKeyOptions) -> ParseResult<GotAccessKey>

从上传凭证内获取 AccessKey

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

Source

fn policy(&self, opts: GetPolicyOptions) -> ParseResult<GotUploadPolicy<'_>>

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

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

Source

fn to_token_string(&self, opts: ToStringOptions) -> ToStringResult<Cow<'_, str>>

生成字符串

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

Provided Methods§

Source

fn async_access_key( &self, opts: GetAccessKeyOptions, ) -> Pin<Box<dyn Future<Output = ParseResult<GotAccessKey>> + Send + '_>>

Available on crate feature async only.

异步从上传凭证内获取 AccessKey

Source

fn async_policy( &self, opts: GetPolicyOptions, ) -> Pin<Box<dyn Future<Output = ParseResult<GotUploadPolicy<'_>>> + Send + '_>>

Available on crate feature async only.

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

Source

fn async_to_token_string( &self, opts: ToStringOptions, ) -> Pin<Box<dyn Future<Output = ToStringResult<Cow<'_, str>>> + Send + '_>>

Available on crate feature async only.

异步生成字符串

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + UploadTokenProvider + ?Sized> UploadTokenProvider for &'a T
where &'a T: DynClone + Debug + Sync + Send,

Source§

fn access_key(&self, opts: GetAccessKeyOptions) -> ParseResult<GotAccessKey>

Source§

fn async_access_key( &self, opts: GetAccessKeyOptions, ) -> Pin<Box<dyn Future<Output = ParseResult<GotAccessKey>> + Send + '_>>

Available on crate feature async only.
Source§

fn policy(&self, opts: GetPolicyOptions) -> ParseResult<GotUploadPolicy<'_>>

Source§

fn async_policy( &self, opts: GetPolicyOptions, ) -> Pin<Box<dyn Future<Output = ParseResult<GotUploadPolicy<'_>>> + Send + '_>>

Available on crate feature async only.
Source§

fn to_token_string(&self, opts: ToStringOptions) -> ToStringResult<Cow<'_, str>>

Source§

fn async_to_token_string( &self, opts: ToStringOptions, ) -> Pin<Box<dyn Future<Output = ToStringResult<Cow<'_, str>>> + Send + '_>>

Available on crate feature async only.
Source§

impl<'a, T: 'a + UploadTokenProvider + ?Sized> UploadTokenProvider for &'a mut T

Source§

fn access_key(&self, opts: GetAccessKeyOptions) -> ParseResult<GotAccessKey>

Source§

fn async_access_key( &self, opts: GetAccessKeyOptions, ) -> Pin<Box<dyn Future<Output = ParseResult<GotAccessKey>> + Send + '_>>

Available on crate feature async only.
Source§

fn policy(&self, opts: GetPolicyOptions) -> ParseResult<GotUploadPolicy<'_>>

Source§

fn async_policy( &self, opts: GetPolicyOptions, ) -> Pin<Box<dyn Future<Output = ParseResult<GotUploadPolicy<'_>>> + Send + '_>>

Available on crate feature async only.
Source§

fn to_token_string(&self, opts: ToStringOptions) -> ToStringResult<Cow<'_, str>>

Source§

fn async_to_token_string( &self, opts: ToStringOptions, ) -> Pin<Box<dyn Future<Output = ToStringResult<Cow<'_, str>>> + Send + '_>>

Available on crate feature async only.
Source§

impl<T: UploadTokenProvider + ?Sized> UploadTokenProvider for Box<T>
where Box<T>: DynClone + Debug + Sync + Send,

Source§

fn access_key(&self, opts: GetAccessKeyOptions) -> ParseResult<GotAccessKey>

Source§

fn async_access_key( &self, opts: GetAccessKeyOptions, ) -> Pin<Box<dyn Future<Output = ParseResult<GotAccessKey>> + Send + '_>>

Available on crate feature async only.
Source§

fn policy(&self, opts: GetPolicyOptions) -> ParseResult<GotUploadPolicy<'_>>

Source§

fn async_policy( &self, opts: GetPolicyOptions, ) -> Pin<Box<dyn Future<Output = ParseResult<GotUploadPolicy<'_>>> + Send + '_>>

Available on crate feature async only.
Source§

fn to_token_string(&self, opts: ToStringOptions) -> ToStringResult<Cow<'_, str>>

Source§

fn async_to_token_string( &self, opts: ToStringOptions, ) -> Pin<Box<dyn Future<Output = ToStringResult<Cow<'_, str>>> + Send + '_>>

Available on crate feature async only.
Source§

impl<T: UploadTokenProvider + ?Sized> UploadTokenProvider for Rc<T>
where Rc<T>: DynClone + Debug + Sync + Send,

Source§

fn access_key(&self, opts: GetAccessKeyOptions) -> ParseResult<GotAccessKey>

Source§

fn async_access_key( &self, opts: GetAccessKeyOptions, ) -> Pin<Box<dyn Future<Output = ParseResult<GotAccessKey>> + Send + '_>>

Available on crate feature async only.
Source§

fn policy(&self, opts: GetPolicyOptions) -> ParseResult<GotUploadPolicy<'_>>

Source§

fn async_policy( &self, opts: GetPolicyOptions, ) -> Pin<Box<dyn Future<Output = ParseResult<GotUploadPolicy<'_>>> + Send + '_>>

Available on crate feature async only.
Source§

fn to_token_string(&self, opts: ToStringOptions) -> ToStringResult<Cow<'_, str>>

Source§

fn async_to_token_string( &self, opts: ToStringOptions, ) -> Pin<Box<dyn Future<Output = ToStringResult<Cow<'_, str>>> + Send + '_>>

Available on crate feature async only.
Source§

impl<T: UploadTokenProvider + ?Sized> UploadTokenProvider for Arc<T>
where Arc<T>: DynClone + Debug + Sync + Send,

Source§

fn access_key(&self, opts: GetAccessKeyOptions) -> ParseResult<GotAccessKey>

Source§

fn async_access_key( &self, opts: GetAccessKeyOptions, ) -> Pin<Box<dyn Future<Output = ParseResult<GotAccessKey>> + Send + '_>>

Available on crate feature async only.
Source§

fn policy(&self, opts: GetPolicyOptions) -> ParseResult<GotUploadPolicy<'_>>

Source§

fn async_policy( &self, opts: GetPolicyOptions, ) -> Pin<Box<dyn Future<Output = ParseResult<GotUploadPolicy<'_>>> + Send + '_>>

Available on crate feature async only.
Source§

fn to_token_string(&self, opts: ToStringOptions) -> ToStringResult<Cow<'_, str>>

Source§

fn async_to_token_string( &self, opts: ToStringOptions, ) -> Pin<Box<dyn Future<Output = ToStringResult<Cow<'_, str>>> + Send + '_>>

Available on crate feature async only.

Implementors§