pub trait FileStorageDyn:
Send
+ Sync
+ 'static {
// Required methods
fn store<'a>(
&'a self,
prefix: &'a str,
file: &'a UploadedFile,
) -> Pin<Box<dyn Future<Output = Result<StoredFile, Error>> + Send + 'a>>;
fn store_stream<'a>(
&'a self,
prefix: &'a str,
stream: &'a mut BufferedUpload,
) -> Pin<Box<dyn Future<Output = Result<StoredFile, Error>> + Send + 'a>>;
fn delete<'a>(
&'a self,
path: &'a str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>;
fn exists<'a>(
&'a self,
path: &'a str,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'a>>;
}Expand description
Object-safe companion to FileStorage for use with Arc<dyn FileStorageDyn>.
This trait is automatically implemented for all types that implement
FileStorage (or FileStorageSend).
Required Methods§
Sourcefn store<'a>(
&'a self,
prefix: &'a str,
file: &'a UploadedFile,
) -> Pin<Box<dyn Future<Output = Result<StoredFile, Error>> + Send + 'a>>
fn store<'a>( &'a self, prefix: &'a str, file: &'a UploadedFile, ) -> Pin<Box<dyn Future<Output = Result<StoredFile, Error>> + Send + 'a>>
Store a buffered in-memory file under prefix/.
A ULID-based unique filename is generated automatically. Returns the stored path and size on success.
Sourcefn store_stream<'a>(
&'a self,
prefix: &'a str,
stream: &'a mut BufferedUpload,
) -> Pin<Box<dyn Future<Output = Result<StoredFile, Error>> + Send + 'a>>
fn store_stream<'a>( &'a self, prefix: &'a str, stream: &'a mut BufferedUpload, ) -> Pin<Box<dyn Future<Output = Result<StoredFile, Error>> + Send + 'a>>
Store a chunked upload under prefix/.
Chunks are consumed from stream sequentially.
Returns the stored path and size on success.