Skip to main content

FileStore

Trait FileStore 

Source
pub trait FileStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn save_file<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        collection: &'life1 str,
        file_id: &'life2 str,
        content: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_file<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        collection: &'life1 str,
        file_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn delete_file<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        collection: &'life1 str,
        file_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Trait for storing, retrieving, and deleting raw binary files.

Required Methods§

Source

fn save_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, collection: &'life1 str, file_id: &'life2 str, content: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Saves raw bytes under the specified collection and unique file identifier.

Source

fn get_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, collection: &'life1 str, file_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Retrieves raw bytes by its identifier.

Source

fn delete_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, collection: &'life1 str, file_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Deletes a file.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§