Struct QiniuUploader

Source
pub struct QiniuUploader { /* private fields */ }
Expand description

Qiniu上传实例

Implementations§

Source§

impl QiniuUploader

Source

pub fn new( access_key: impl Into<String>, secret_key: impl Into<String>, bucket: impl Into<String>, region: Option<QiniuRegionEnum>, debug: bool, ) -> Self

§生成上传实例
§参数
  • access_key: 七牛access_key
  • secret_key: 七牛secret_key
  • bucket: 七牛bucket
  • region: 七牛上传区域,默认z0
  • debug: 是否开启debug
Source

pub async fn upload_file<R: AsyncReadExt + Unpin + Send + Sync + 'static>( &self, key: &str, data: R, mime: Mime, file_size: usize, progress_style: Option<ProgressStyle>, ) -> Result<(), Error>

Available on crate feature progress-bar only.
§直传文件,带进度条

https://developer.qiniu.com/kodo/1312/upload

§参数
  • key: 上传文件的key,如test/Cargo.lock
  • data: R: AsyncReadExt + Unpin + Send + Sync + ’static
  • mime: 文件类型
  • file_size: 文件大小,单位 Byte
  • progress_style: 进度条样式
Source

pub async fn upload_file_no_progress_bar<T: Into<Body>>( &self, key: &str, data: T, mime: Mime, ) -> Result<(), Error>

Available on crate feature progress-bar only.
§直传文件,没有进度条

https://developer.qiniu.com/kodo/1312/upload

§参数
  • key: 上传文件的key,如test/Cargo.lock
  • data: T: Into<Body>
  • mime: 文件类型
Source

pub async fn part_upload_file<R: AsyncReadExt + Unpin + Send + Sync + 'static>( self, key: &str, data: R, file_size: usize, part_size: Option<usize>, threads: Option<u8>, progress_style: Option<ProgressStyle>, ) -> Result<(), Error>

Available on crate feature progress-bar only.
§分片上传 v2 版,显示进度条

https://developer.qiniu.com/kodo/6364/multipartupload-interface

§参数
  • key: 上传的key,如test/Cargo.lock
  • data: R: AsyncReadExt + Unpin + Send + Sync + ’static
  • file_size: 文件大小,单位 Byte
  • part_size: 分片上传的大小,单位Byte,1M-1GB之间,如果指定,优先级比threads参数高
  • threads: 分片上传线程,在未指定part_size参数的情况下生效,默认5
  • progress_style: 进度条样式
Source

pub async fn part_upload_file_no_progress_bar<R: AsyncReadExt + Unpin + Send + Sync + 'static>( self, key: &str, data: R, file_size: usize, part_size: Option<usize>, threads: Option<u8>, ) -> Result<(), Error>

Available on crate feature progress-bar only.
§分片上传 v2 版,不显示进度条

https://developer.qiniu.com/kodo/6364/multipartupload-interface

§参数
  • key: 上传的key,如test/Cargo.lock
  • data: R: AsyncReadExt + Unpin + Send + Sync + ’static
  • file_size: 文件大小,单位 Byte
  • part_size: 分片上传的大小,单位Byte,1M-1GB之间,如果指定,优先级比threads参数高
  • threads: 分片上传线程,在未指定part_size参数的情况下生效,默认5
Source

pub async fn part_abort(&self, key: &str, upload_id: &str) -> Result<(), Error>

§终止上传(分片)

https://developer.qiniu.com/kodo/6367/abort-multipart-upload

§参数
  • key: 上传的key,如test/Cargo.lock
  • upload_id: upload 任务 id

Trait Implementations§

Source§

impl Clone for QiniuUploader

Source§

fn clone(&self) -> QiniuUploader

Returns a duplicate 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 Debug for QiniuUploader

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,