pub trait SinglePartUploader:
Sealed
+ UploaderWithCallbacks
+ Clone
+ Sync
+ Send
+ Debug {
// Required methods
fn new(upload_manager: UploadManager) -> Self;
fn upload_path(
&self,
path: impl AsRef<Path>,
params: ObjectParams,
) -> ApiResult<Value>;
fn upload_reader<R: Read + 'static>(
&self,
reader: R,
params: ObjectParams,
) -> ApiResult<Value>;
fn async_upload_path<'a>(
&'a self,
path: impl AsRef<Path> + Send + Sync + 'a,
params: ObjectParams,
) -> BoxFuture<'a, ApiResult<Value>>;
fn async_upload_reader<R: AsyncRead + Unpin + Send + Sync + 'static>(
&self,
reader: R,
params: ObjectParams,
) -> BoxFuture<'_, ApiResult<Value>>;
}
Expand description
单请求上传器接口
仅通过一次 HTTP 请求即上传整个数据源,适合数据量较小的数据源,不提供断点恢复的能力。
Required Methods§
Sourcefn new(upload_manager: UploadManager) -> Self
fn new(upload_manager: UploadManager) -> Self
创建单请求上传器
Sourcefn upload_path(
&self,
path: impl AsRef<Path>,
params: ObjectParams,
) -> ApiResult<Value>
fn upload_path( &self, path: impl AsRef<Path>, params: ObjectParams, ) -> ApiResult<Value>
上传指定路径的文件
该方法的异步版本为 Self::async_upload_path
。
Sourcefn upload_reader<R: Read + 'static>(
&self,
reader: R,
params: ObjectParams,
) -> ApiResult<Value>
fn upload_reader<R: Read + 'static>( &self, reader: R, params: ObjectParams, ) -> ApiResult<Value>
上传输入流的数据
该方法的异步版本为 Self::async_upload_reader
。
Sourcefn async_upload_path<'a>(
&'a self,
path: impl AsRef<Path> + Send + Sync + 'a,
params: ObjectParams,
) -> BoxFuture<'a, ApiResult<Value>>
Available on crate feature async
only.
fn async_upload_path<'a>( &'a self, path: impl AsRef<Path> + Send + Sync + 'a, params: ObjectParams, ) -> BoxFuture<'a, ApiResult<Value>>
async
only.异步上传指定路径的文件
Sourcefn async_upload_reader<R: AsyncRead + Unpin + Send + Sync + 'static>(
&self,
reader: R,
params: ObjectParams,
) -> BoxFuture<'_, ApiResult<Value>>
Available on crate feature async
only.
fn async_upload_reader<R: AsyncRead + Unpin + Send + Sync + 'static>( &self, reader: R, params: ObjectParams, ) -> BoxFuture<'_, ApiResult<Value>>
async
only.上传异步输入流的数据
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.