Struct GotUploadPolicy

Source
pub struct GotUploadPolicy<'a>(/* private fields */);
Expand description

获取的上传策略

该数据结构目前和上传策略相同,可以和上传策略相互转换,但之后可能会添加更多字段

Implementations§

Source§

impl GotUploadPolicy<'_>

Source

pub fn upload_policy(&self) -> &UploadPolicy

获取上传策略

Source

pub fn upload_policy_mut(&mut self) -> &mut UploadPolicy

获取上传策略的可变引用

Source

pub fn into_upload_policy(self) -> UploadPolicy

转换为上传策略

Methods from Deref<Target = UploadPolicy>§

Source

pub fn bucket(&self) -> Option<&str>

存储空间约束

Source

pub fn key(&self) -> Option<&str>

对象名称约束或对象名称前缀约束

Source

pub fn use_prefixal_object_key(&self) -> bool

是否是对象名称前缀约束

Source

pub fn is_insert_only(&self) -> bool

是否仅允许新增对象,不允许覆盖对象

Source

pub fn mime_detection_enabled(&self) -> bool

是否启用 MIME 类型自动检测

Source

pub fn token_deadline(&self) -> Option<SystemTime>

上传凭证过期时间

Source

pub fn return_url(&self) -> Option<&str>

Web 端文件上传成功后,浏览器执行 303 跳转的 URL

Source

pub fn return_body(&self) -> Option<&str>

上传成功后,自定义七牛云最终返回给上传端的数据

Source

pub fn callback_urls(&self) -> Option<Split<'_, char>>

上传成功后,七牛云向业务服务器发送 POST 请求的 URL 列表

Source

pub fn callback_host(&self) -> Option<&str>

上传成功后,七牛云向业务服务器发送回调请求时的 Host

Source

pub fn callback_body(&self) -> Option<&str>

上传成功后,七牛云向业务服务器发送回调请求时的内容

支持魔法变量自定义变量

Source

pub fn callback_body_type(&self) -> Option<&str>

上传成功后,七牛云向业务服务器发送回调请求时的 Content-Type

默认为 application/x-www-form-urlencoded,也可设置为 application/json

Source

pub fn save_key(&self) -> Option<&str>

自定义对象名称

支持魔法变量自定义变量

Source

pub fn is_save_key_forced(&self) -> bool

是否忽略客户端指定的对象名称,强制使用自定义对象名称进行文件命名

Source

pub fn file_size_limitation(&self) -> (Option<u64>, Option<u64>)

限定上传文件尺寸的范围

返回的第一个元素为最小尺寸,第二个元素为最大尺寸,如果为 None 表示不限制,单位为字节

Source

pub fn mime_types(&self) -> Option<Split<'_, char>>

限定用户上传的文件类型

指定本字段值,七牛服务器会侦测文件内容以判断 MIME 类型,再用判断值跟指定值进行匹配, 匹配成功则允许上传,匹配失败则返回 403 状态码

Source

pub fn file_type(&self) -> Option<FileType>

文件类型

Source

pub fn object_lifetime(&self) -> Option<Duration>

对象生命周期

精确到天

Source

pub fn as_json(&self) -> String

获取 JSON 格式的上传凭证

Source

pub fn get(&self, key: impl JsonValueIndex) -> Option<&JsonValue>

根据指定的上传策略字段获取相应的值

Source

pub fn keys(&self) -> JsonMapKeys<'_>

获取上传策略的字段迭代器

Source

pub fn values(&self) -> JsonMapValues<'_>

获取上传策略的字段值的迭代器

Trait Implementations§

Source§

impl<'a> Clone for GotUploadPolicy<'a>

Source§

fn clone(&self) -> GotUploadPolicy<'a>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for GotUploadPolicy<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for GotUploadPolicy<'_>

Source§

type Target = UploadPolicy

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for GotUploadPolicy<'_>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'a> From<&'a UploadPolicy> for GotUploadPolicy<'a>

Source§

fn from(policy: &'a UploadPolicy) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Cow<'a, UploadPolicy>> for GotUploadPolicy<'a>

Source§

fn from(policy: Cow<'a, UploadPolicy>) -> Self

Converts to this type from the input type.
Source§

impl From<GotUploadPolicy<'_>> for UploadPolicy

Source§

fn from(result: GotUploadPolicy<'_>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<GotUploadPolicy<'a>> for Cow<'a, UploadPolicy>

Source§

fn from(result: GotUploadPolicy<'a>) -> Self

Converts to this type from the input type.
Source§

impl From<UploadPolicy> for GotUploadPolicy<'_>

Source§

fn from(policy: UploadPolicy) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for GotUploadPolicy<'a>

§

impl<'a> RefUnwindSafe for GotUploadPolicy<'a>

§

impl<'a> Send for GotUploadPolicy<'a>

§

impl<'a> Sync for GotUploadPolicy<'a>

§

impl<'a> Unpin for GotUploadPolicy<'a>

§

impl<'a> UnwindSafe for GotUploadPolicy<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.