Skip to main content

Files

Trait Files 

Source
pub trait Files:
    Send
    + Sync
    + 'static {
    // Required methods
    fn provider(&self) -> &ProviderId;
    fn upload_file(
        &self,
        options: UploadFileOptions,
    ) -> impl Future<Output = Result<UploadFileResult, ProviderError>> + Send;

    // Provided methods
    fn supports_get_file_metadata(&self) -> bool { ... }
    fn get_file_metadata(
        &self,
        options: FileReferenceOptions,
    ) -> impl Future<Output = Result<FileMetadataResult, ProviderError>> + Send { ... }
    fn supports_download_file(&self) -> bool { ... }
    fn download_file(
        &self,
        options: FileReferenceOptions,
    ) -> impl Future<Output = Result<DownloadFileResult, ProviderError>> + Send { ... }
    fn supports_delete_file(&self) -> bool { ... }
    fn delete_file(
        &self,
        options: FileReferenceOptions,
    ) -> impl Future<Output = Result<DeleteFileResult, ProviderError>> + Send { ... }
}
Expand description

Upload, inspect, download and delete files stored at the provider.

Only upload_file is required; the other operations are gated by supports_* queries and default to an UnsupportedFunctionality error.

Required Methods§

Source

fn provider(&self) -> &ProviderId

Provider identifier.

Source

fn upload_file( &self, options: UploadFileOptions, ) -> impl Future<Output = Result<UploadFileResult, ProviderError>> + Send

Uploads a file and returns its provider reference.

Provided Methods§

Source

fn supports_get_file_metadata(&self) -> bool

Whether get_file_metadata is implemented.

Source

fn get_file_metadata( &self, options: FileReferenceOptions, ) -> impl Future<Output = Result<FileMetadataResult, ProviderError>> + Send

Fetches metadata of an uploaded file.

Source

fn supports_download_file(&self) -> bool

Whether download_file is implemented.

Source

fn download_file( &self, options: FileReferenceOptions, ) -> impl Future<Output = Result<DownloadFileResult, ProviderError>> + Send

Downloads an uploaded file.

Source

fn supports_delete_file(&self) -> bool

Whether delete_file is implemented.

Source

fn delete_file( &self, options: FileReferenceOptions, ) -> impl Future<Output = Result<DeleteFileResult, ProviderError>> + Send

Deletes an uploaded file.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§