Trait File

Source
pub trait File<Client>: GetStd
where Client: Files<ObjectPath>,
{ // Required method fn oss_client(&self) -> Client; // Provided methods fn put_oss<'life0, 'life1, 'async_trait>( &'life0 self, content: Vec<u8>, content_type: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Response, FileError>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn get_oss<'life0, 'async_trait, Num, R>( &'life0 self, range: R, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, FileError>> + Send + 'async_trait>> where R: Into<ContentRange<Num>> + Send + Sync + 'async_trait, ContentRange<Num>: Into<HeaderValue>, Num: 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn delete_oss<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), FileError>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } }
Expand description

§文件的相关操作

包括 上传,下载,删除等功能

Required Methods§

Source

fn oss_client(&self) -> Client

指定发起 OSS 接口调用的客户端

Provided Methods§

Source

fn put_oss<'life0, 'life1, 'async_trait>( &'life0 self, content: Vec<u8>, content_type: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Response, FileError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

上传文件内容到 OSS 上面

Source

fn get_oss<'life0, 'async_trait, Num, R>( &'life0 self, range: R, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, FileError>> + Send + 'async_trait>>
where R: Into<ContentRange<Num>> + Send + Sync + 'async_trait, ContentRange<Num>: Into<HeaderValue>, Num: 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait,

§获取 OSS 上文件的部分或全部内容

参数可指定范围:

  • .. 获取文件的所有内容,常规大小的文件,使用这个即可
  • ..100, 100..200, 200.. 可用于获取文件的部分内容,一般用于大文件
Source

fn delete_oss<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), FileError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

§从 OSS 中删除文件

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.

Implementors§