Trait email::Backend

source ·
pub trait Backend: Send {
Show 21 methods // Required methods fn name(&self) -> String; fn add_folder<'life0, 'life1, 'async_trait>( &'life0 mut self, folder: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_folders<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<Folders>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn expunge_folder<'life0, 'life1, 'async_trait>( &'life0 mut self, folder: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn purge_folder<'life0, 'life1, 'async_trait>( &'life0 mut self, folder: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete_folder<'life0, 'life1, 'async_trait>( &'life0 mut self, folder: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_envelope<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, folder: &'life1 str, id: &'life2 str ) -> Pin<Box<dyn Future<Output = Result<Envelope>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn list_envelopes<'life0, 'life1, 'async_trait>( &'life0 mut self, folder: &'life1 str, page_size: usize, page: usize ) -> Pin<Box<dyn Future<Output = Result<Envelopes>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn search_envelopes<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, folder: &'life1 str, query: &'life2 str, sort: &'life3 str, page_size: usize, page: usize ) -> Pin<Box<dyn Future<Output = Result<Envelopes>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn add_email<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, folder: &'life1 str, email: &'life2 [u8], flags: &'life3 Flags ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn preview_emails<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, folder: &'life1 str, ids: Vec<&'life2 str> ) -> Pin<Box<dyn Future<Output = Result<Messages>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_emails<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, folder: &'life1 str, ids: Vec<&'life2 str> ) -> Pin<Box<dyn Future<Output = Result<Messages>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn copy_emails<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, from_folder: &'life1 str, to_folder: &'life2 str, ids: Vec<&'life3 str> ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn move_emails<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, from_folder: &'life1 str, to_folder: &'life2 str, ids: Vec<&'life3 str> ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn delete_emails<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, folder: &'life1 str, ids: Vec<&'life2 str> ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn add_flags<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, folder: &'life1 str, ids: Vec<&'life2 str>, flags: &'life3 Flags ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn set_flags<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, folder: &'life1 str, ids: Vec<&'life2 str>, flags: &'life3 Flags ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn remove_flags<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, folder: &'life1 str, ids: Vec<&'life2 str>, flags: &'life3 Flags ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn as_any(&self) -> &dyn Any; // Provided methods fn mark_emails_as_deleted<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, folder: &'life1 str, ids: Vec<&'life2 str> ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn close(&mut self) -> Result<()> { ... }
}
Expand description

The backend abstraction.

The backend trait abstracts every action needed to manipulate emails.

Required Methods§

source

fn name(&self) -> String

Returns the name of the backend.

source

fn add_folder<'life0, 'life1, 'async_trait>( &'life0 mut self, folder: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Creates the given folder.

source

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

Lists all available folders.

source

fn expunge_folder<'life0, 'life1, 'async_trait>( &'life0 mut self, folder: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Expunges the given folder.

The concept is similar to the IMAP expunge: it definitely deletes emails that have the Deleted flag.

source

fn purge_folder<'life0, 'life1, 'async_trait>( &'life0 mut self, folder: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Purges the given folder.

Manipulate with caution: all emails contained in the given folder are definitely deleted.

source

fn delete_folder<'life0, 'life1, 'async_trait>( &'life0 mut self, folder: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Definitely deletes the given folder.

Manipulate with caution: all emails contained in the given folder are also definitely deleted.

source

fn get_envelope<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, folder: &'life1 str, id: &'life2 str ) -> Pin<Box<dyn Future<Output = Result<Envelope>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Gets the envelope from the given folder matching the given id.

source

fn list_envelopes<'life0, 'life1, 'async_trait>( &'life0 mut self, folder: &'life1 str, page_size: usize, page: usize ) -> Pin<Box<dyn Future<Output = Result<Envelopes>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Lists all available envelopes from the given folder matching the given pagination.

source

fn search_envelopes<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, folder: &'life1 str, query: &'life2 str, sort: &'life3 str, page_size: usize, page: usize ) -> Pin<Box<dyn Future<Output = Result<Envelopes>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Sorts and filters envelopes from the given folder matching the given query, sort and pagination.

source

fn add_email<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, folder: &'life1 str, email: &'life2 [u8], flags: &'life3 Flags ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Adds the given raw email with the given flags to the given folder.

source

fn preview_emails<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, folder: &'life1 str, ids: Vec<&'life2 str> ) -> Pin<Box<dyn Future<Output = Result<Messages>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Previews emails from the given folder matching the given ids.

Same as get_emails, except that it just “previews”: the Seen flag is not applied to the corresponding envelopes.

source

fn get_emails<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, folder: &'life1 str, ids: Vec<&'life2 str> ) -> Pin<Box<dyn Future<Output = Result<Messages>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Gets emails from the given folder matching the given ids.

source

fn copy_emails<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, from_folder: &'life1 str, to_folder: &'life2 str, ids: Vec<&'life3 str> ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Copies emails from the given folder to the given folder matching the given ids.

source

fn move_emails<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, from_folder: &'life1 str, to_folder: &'life2 str, ids: Vec<&'life3 str> ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Moves emails from the given folder to the given folder matching the given ids.

source

fn delete_emails<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, folder: &'life1 str, ids: Vec<&'life2 str> ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Deletes emails from the given folder matching the given ids.

In fact the matching emails are not deleted, they are moved to the trash folder. If the given folder IS the trash folder, then it adds the Deleted flag instead. Matching emails will be definitely deleted after calling expunge_folder.

source

fn add_flags<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, folder: &'life1 str, ids: Vec<&'life2 str>, flags: &'life3 Flags ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Adds the given flags to envelopes matching the given ids from the given folder.

source

fn set_flags<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, folder: &'life1 str, ids: Vec<&'life2 str>, flags: &'life3 Flags ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Replaces envelopes flags matching the given ids from the given folder.

source

fn remove_flags<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, folder: &'life1 str, ids: Vec<&'life2 str>, flags: &'life3 Flags ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Removes the given flags to envelopes matching the given ids from the given folder.

source

fn as_any(&self) -> &dyn Any

Provided Methods§

source

fn mark_emails_as_deleted<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, folder: &'life1 str, ids: Vec<&'life2 str> ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Alias for adding the Deleted flag to the matching envelopes.

source

fn close(&mut self) -> Result<()>

Cleans up sessions, clients, cache etc.

Implementors§