Skip to main content

TrashBackend

Trait TrashBackend 

Source
pub trait TrashBackend: Send + Sync {
    // Required methods
    fn trash<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 Path,
    ) -> Pin<Box<dyn Future<Output = Result<(), TrashError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list<'life0, 'life1, 'async_trait>(
        &'life0 self,
        filter: Option<&'life1 str>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<TrashEntry>, TrashError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_by_name<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<TrashEntry>, TrashError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn restore<'life0, 'async_trait>(
        &'life0 self,
        entries: Vec<TrashEntry>,
    ) -> Pin<Box<dyn Future<Output = Result<(), TrashError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn purge_all<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<usize, TrashError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Backend trait for trash operations.

Required Methods§

Source

fn trash<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<(), TrashError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Move a file or directory to trash.

Source

fn list<'life0, 'life1, 'async_trait>( &'life0 self, filter: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<TrashEntry>, TrashError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List trashed items, optionally filtered by name substring.

Source

fn find_by_name<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<TrashEntry>, TrashError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Find entries matching a name (exact first, then substring).

Returns matched entries or an error describing the ambiguity.

Source

fn restore<'life0, 'async_trait>( &'life0 self, entries: Vec<TrashEntry>, ) -> Pin<Box<dyn Future<Output = Result<(), TrashError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Restore trashed items to their original locations.

Source

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

Permanently delete all trashed items. Returns count purged.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§