Struct Backend

Source
pub struct Backend<C>
where C: BackendContext,
{
Show 22 fields pub account_config: Arc<AccountConfig>, pub context: Arc<C>, pub add_folder: Option<BackendFeature<C, dyn AddFolder>>, pub list_folders: Option<BackendFeature<C, dyn ListFolders>>, pub expunge_folder: Option<BackendFeature<C, dyn ExpungeFolder>>, pub purge_folder: Option<BackendFeature<C, dyn PurgeFolder>>, pub delete_folder: Option<BackendFeature<C, dyn DeleteFolder>>, pub get_envelope: Option<BackendFeature<C, dyn GetEnvelope>>, pub list_envelopes: Option<BackendFeature<C, dyn ListEnvelopes>>, pub thread_envelopes: Option<BackendFeature<C, dyn ThreadEnvelopes>>, pub watch_envelopes: Option<BackendFeature<C, dyn WatchEnvelopes>>, pub add_flags: Option<BackendFeature<C, dyn AddFlags>>, pub set_flags: Option<BackendFeature<C, dyn SetFlags>>, pub remove_flags: Option<BackendFeature<C, dyn RemoveFlags>>, pub add_message: Option<BackendFeature<C, dyn AddMessage>>, pub send_message: Option<BackendFeature<C, dyn SendMessage>>, pub peek_messages: Option<BackendFeature<C, dyn PeekMessages>>, pub get_messages: Option<BackendFeature<C, dyn GetMessages>>, pub copy_messages: Option<BackendFeature<C, dyn CopyMessages>>, pub move_messages: Option<BackendFeature<C, dyn MoveMessages>>, pub delete_messages: Option<BackendFeature<C, dyn DeleteMessages>>, pub remove_messages: Option<BackendFeature<C, dyn RemoveMessages>>,
}
Expand description

The basic backend implementation.

This is the most primitive backend implementation: it owns its context, and backend features are directly called from it.

This implementation is useful when you need to call features in serie. If you need to call features in batch (parallel), see the [pool::BackendPool] implementation instead.

Fields§

§account_config: Arc<AccountConfig>

The account configuration.

§context: Arc<C>

The backend context.

§add_folder: Option<BackendFeature<C, dyn AddFolder>>

The add folder backend feature.

§list_folders: Option<BackendFeature<C, dyn ListFolders>>

The list folders backend feature.

§expunge_folder: Option<BackendFeature<C, dyn ExpungeFolder>>

The expunge folder backend feature.

§purge_folder: Option<BackendFeature<C, dyn PurgeFolder>>

The purge folder backend feature.

§delete_folder: Option<BackendFeature<C, dyn DeleteFolder>>

The delete folder backend feature.

§get_envelope: Option<BackendFeature<C, dyn GetEnvelope>>

The get envelope backend feature.

§list_envelopes: Option<BackendFeature<C, dyn ListEnvelopes>>

The list envelopes backend feature.

§thread_envelopes: Option<BackendFeature<C, dyn ThreadEnvelopes>>

The thread envelopes backend feature.

§watch_envelopes: Option<BackendFeature<C, dyn WatchEnvelopes>>

The watch envelopes backend feature.

§add_flags: Option<BackendFeature<C, dyn AddFlags>>

The add flags backend feature.

§set_flags: Option<BackendFeature<C, dyn SetFlags>>

The set flags backend feature.

§remove_flags: Option<BackendFeature<C, dyn RemoveFlags>>

The remove flags backend feature.

§add_message: Option<BackendFeature<C, dyn AddMessage>>

The add message backend feature.

§send_message: Option<BackendFeature<C, dyn SendMessage>>

The send message backend feature.

§peek_messages: Option<BackendFeature<C, dyn PeekMessages>>

The peek messages backend feature.

§get_messages: Option<BackendFeature<C, dyn GetMessages>>

The get messages backend feature.

§copy_messages: Option<BackendFeature<C, dyn CopyMessages>>

The copy messages backend feature.

§move_messages: Option<BackendFeature<C, dyn MoveMessages>>

The move messages backend feature.

§delete_messages: Option<BackendFeature<C, dyn DeleteMessages>>

The delete messages backend feature.

§remove_messages: Option<BackendFeature<C, dyn RemoveMessages>>

The delete messages backend feature.

Trait Implementations§

Source§

impl<C: BackendContext> AddFlags for Backend<C>

Source§

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

Add the given flags to envelope(s) matching the given id from the given folder.
Source§

fn add_flag<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, folder: &'life1 str, id: &'life2 Id, flag: Flag, ) -> Pin<Box<dyn Future<Output = AnyResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Add the given flag to envelope(s) matching the given id from the given folder.
Source§

impl<C: BackendContext> AddFolder for Backend<C>

Source§

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

Create the given folder.
Source§

impl<C: BackendContext> AddMessage for Backend<C>

Source§

fn add_message_with_flags<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, folder: &'life1 str, msg: &'life2 [u8], flags: &'life3 Flags, ) -> Pin<Box<dyn Future<Output = AnyResult<SingleId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Add the given raw email message with the given flags to the given folder.
Source§

fn add_message_with_flag<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, folder: &'life1 str, msg: &'life2 [u8], flag: Flag, ) -> Pin<Box<dyn Future<Output = AnyResult<SingleId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Add the given raw email message with the given flag to the given folder.
Source§

fn add_message<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, folder: &'life1 str, msg: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = AnyResult<SingleId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Add the given raw email message to the given folder.
Source§

impl<C: BackendContext> CopyMessages for Backend<C>

Source§

fn copy_messages<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, from_folder: &'life1 str, to_folder: &'life2 str, id: &'life3 Id, ) -> Pin<Box<dyn Future<Output = AnyResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Copy emails from the given folder to the given folder matching the given id.
Source§

impl<C: BackendContext> DeleteFolder for Backend<C>

Source§

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

Definitely delete the given folder. Read more
Source§

impl<C: BackendContext> DeleteMessages for Backend<C>

Source§

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

Delete messages from the given folder matching the given envelope id(s). Read more
Source§

impl<C: BackendContext> ExpungeFolder for Backend<C>

Source§

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

Expunge the given folder. Read more
Source§

impl<C: BackendContext> GetEnvelope for Backend<C>

Source§

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

Get the envelope from the given folder matching the given id.
Source§

impl<C: BackendContext> GetMessages for Backend<C>

Source§

fn get_messages<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, folder: &'life1 str, id: &'life2 Id, ) -> Pin<Box<dyn Future<Output = AnyResult<Messages>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get email messages from the given folder matching the given ids. Read more
Source§

impl<C: BackendContext> HasAccountConfig for Backend<C>

Source§

impl<C: BackendContext> ListEnvelopes for Backend<C>

Source§

fn list_envelopes<'life0, 'life1, 'async_trait>( &'life0 self, folder: &'life1 str, opts: ListEnvelopesOptions, ) -> Pin<Box<dyn Future<Output = AnyResult<Envelopes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List all available envelopes from the given folder matching the given pagination.
Source§

impl<C: BackendContext> ListFolders for Backend<C>

Source§

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

List all available folders (alias mailboxes).
Source§

impl<C: BackendContext> MoveMessages for Backend<C>

Source§

fn move_messages<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, from_folder: &'life1 str, to_folder: &'life2 str, id: &'life3 Id, ) -> Pin<Box<dyn Future<Output = AnyResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Move emails from the given folder to the given folder matching the given id.
Source§

impl<C: BackendContext> PeekMessages for Backend<C>

Source§

fn peek_messages<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, folder: &'life1 str, id: &'life2 Id, ) -> Pin<Box<dyn Future<Output = AnyResult<Messages>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Peek email messages from the given folder matching the given ids. Read more
Source§

impl<C: BackendContext> PurgeFolder for Backend<C>

Source§

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

Purge the given folder. Read more
Source§

impl<C: BackendContext> RemoveFlags for Backend<C>

Source§

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

Remove the given flags from envelope(s) matching the given id from the given folder.
Source§

fn remove_flag<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, folder: &'life1 str, id: &'life2 Id, flag: Flag, ) -> Pin<Box<dyn Future<Output = AnyResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Remove the given flag from envelope(s) matching the given id from the given folder.
Source§

impl<C: BackendContext> RemoveMessages for Backend<C>

Source§

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

Remove messages from the given folder matching the given envelope id(s). Read more
Source§

impl<C: BackendContext> SendMessage for Backend<C>

Source§

fn send_message<'life0, 'life1, 'async_trait>( &'life0 self, msg: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = AnyResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send the given raw email message.
Source§

impl<C: BackendContext> SetFlags for Backend<C>

Source§

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

Set the given flags to envelope(s) matching the given id from the given folder. Read more
Source§

fn set_flag<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, folder: &'life1 str, id: &'life2 Id, flag: Flag, ) -> Pin<Box<dyn Future<Output = AnyResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Set the given flag to envelope(s) matching the given id from the given folder. Read more
Source§

impl<C: BackendContext> ThreadEnvelopes for Backend<C>

Source§

fn thread_envelopes<'life0, 'life1, 'async_trait>( &'life0 self, folder: &'life1 str, opts: ListEnvelopesOptions, ) -> Pin<Box<dyn Future<Output = AnyResult<ThreadedEnvelopes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Thread all available envelopes from the given folder matching the given pagination.
Source§

fn thread_envelope<'life0, 'life1, 'async_trait>( &'life0 self, folder: &'life1 str, id: SingleId, opts: ListEnvelopesOptions, ) -> Pin<Box<dyn Future<Output = AnyResult<ThreadedEnvelopes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl<C: BackendContext> WatchEnvelopes for Backend<C>

Source§

fn watch_envelopes<'life0, 'life1, 'async_trait>( &'life0 self, folder: &'life1 str, wait_for_shutdown_request: Receiver<()>, shutdown: Sender<()>, ) -> Pin<Box<dyn Future<Output = AnyResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Watch the given folder for envelopes changes.
Source§

fn exec_hooks<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, config: &'life1 AccountConfig, prev_envelopes: &'life2 HashMap<String, Envelope>, next_envelopes: &'life3 HashMap<String, Envelope>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Auto Trait Implementations§

§

impl<C> Freeze for Backend<C>

§

impl<C> !RefUnwindSafe for Backend<C>

§

impl<C> Send for Backend<C>

§

impl<C> Sync for Backend<C>

§

impl<C> Unpin for Backend<C>

§

impl<C> !UnwindSafe for Backend<C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SendMessageThenSaveCopy for T

Source§

fn send_message_then_save_copy<'life0, 'life1, 'async_trait>( &'life0 self, msg: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = AnyResult<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send the given raw email message, then save a copy to the Sent folder.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T

Source§

impl<T> MaybeSync for T