pub struct QiniuUploader { /* private fields */ }
Expand description
Qiniu上传实例
Implementations§
Source§impl QiniuUploader
impl QiniuUploader
Sourcepub fn new(
access_key: impl Into<String>,
secret_key: impl Into<String>,
bucket: impl Into<String>,
region: Option<QiniuRegionEnum>,
debug: bool,
) -> Self
pub fn new( access_key: impl Into<String>, secret_key: impl Into<String>, bucket: impl Into<String>, region: Option<QiniuRegionEnum>, debug: bool, ) -> Self
Sourcepub 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.
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>
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: 进度条样式
Sourcepub 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.
pub async fn upload_file_no_progress_bar<T: Into<Body>>( &self, key: &str, data: T, mime: Mime, ) -> Result<(), Error>
progress-bar
only.§直传文件,没有进度条
https://developer.qiniu.com/kodo/1312/upload
§参数
- key: 上传文件的key,如test/Cargo.lock
- data: T: Into<Body>
- mime: 文件类型
Sourcepub 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.
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>
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: 进度条样式
Sourcepub 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.
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>
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
Sourcepub async fn part_abort(&self, key: &str, upload_id: &str) -> Result<(), Error>
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
impl Clone for QiniuUploader
Source§fn clone(&self) -> QiniuUploader
fn clone(&self) -> QiniuUploader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for QiniuUploader
impl RefUnwindSafe for QiniuUploader
impl Send for QiniuUploader
impl Sync for QiniuUploader
impl Unpin for QiniuUploader
impl UnwindSafe for QiniuUploader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more