Struct UpYun

Source
pub struct UpYun {
    pub bucket: String,
    pub operator: String,
    pub password: String,
    pub timeout: u64,
    pub endpoint: Endpoint,
    pub client: Client,
}
Expand description

Upyun 实例

Fields§

§bucket: String

服务名称

§operator: String

操作员

§password: String

密码

§timeout: u64

请求超时时间(默认:30s)

§endpoint: Endpoint

接入点(默认为自动识别接入点)

§client: Client

HTTP 客户端

Implementations§

Source§

impl UpYun

Source

pub fn builder() -> UpyunBuilder

构造器

Source§

impl UpYun

Source

pub async fn usage(&self) -> Result<u64, Box<dyn Error>>

获取服务使用量

Source

pub async fn mkdir(&self, path_to_folder: &str) -> Result<(), Box<dyn Error>>

创建目录

Source

pub async fn rm(&self, path: &str) -> Result<(), Box<dyn Error>>

删除目录或文件

path 可以是目录或文件路径,如果是目录,只允许删除空的目录,否则删除请求会被拒绝

Source

pub async fn file_info( &self, path_to_file: &str, ) -> Result<FileInfo, Box<dyn Error>>

获取文件信息

Source

pub async fn list_dir( &self, path_to_folder: &str, params: Option<ListDirParams>, ) -> Result<ListDir, Box<dyn Error>>

获取目录文件列表

Source

pub async fn copy_file( &self, save_as_file: &str, params: CopyParams, ) -> Result<(), Box<dyn Error>>

复制文件

同一个 bucket 下复制文件。并且它只能操作文件,不能操作文件夹。

Source

pub async fn move_file( &self, save_as_file: &str, params: MoveParams, ) -> Result<(), Box<dyn Error>>

移动文件

该操作可以进行文件重命名、文件移动。

同一个 bucket 下移动文件。并且它只能操作文件,不能操作文件夹。

Source

pub async fn download( &self, path_to_file: &str, ) -> Result<Vec<u8>, Box<dyn Error>>

下载文件

Source

pub async fn upload( &self, path_to_file: &str, file: Vec<u8>, params: Option<UploadParams>, ) -> Result<(), Box<dyn Error>>

上传文件

Auto Trait Implementations§

§

impl Freeze for UpYun

§

impl !RefUnwindSafe for UpYun

§

impl Send for UpYun

§

impl Sync for UpYun

§

impl Unpin for UpYun

§

impl !UnwindSafe for UpYun

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

Source§

type Output = T

Should always be Self
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,

Source§

impl<T> MaybeSendSync for T