Struct email::backend::imap::ImapBackend

source ·
pub struct ImapBackend { /* private fields */ }
Expand description

The IMAP backend.

Implementations§

source§

impl ImapBackend

source

pub async fn new( account_config: AccountConfig, imap_config: ImapConfig, default_credentials: Option<String> ) -> Result<ImapBackend>

Creates a new IMAP backend.

The IMAP session is created at this moment. If the session cannot be created using the OAuth 2.0 authentication, the access token is refreshed first then a new session is created.

source

pub async fn notify(&mut self, keepalive: u64, folder: &str) -> Result<()>

Starts the notify daemon.

The notify service uses the IDLE IMAP mode to wait for changes on the server and to run the notify command from the account configuration in case new envelopes are available.

source

pub async fn watch(&mut self, keepalive: u64, folder: &str) -> Result<()>

Starts the watch daemon.

The watch service uses the IDLE IMAP mode to wait for changes on the server and to run the watch commands from the account configuration, in series.

Trait Implementations§

source§

impl Backend for ImapBackend

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. Read more
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. Read more
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. Read more
source§

fn get_envelope<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, folder: &'life1 str, uid: &'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, uids: 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. Read more
source§

fn get_emails<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, folder: &'life1 str, uids: 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, uids: 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, uids: 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, uids: 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. Read more
source§

fn add_flags<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, folder: &'life1 str, uids: 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, uids: 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, uids: 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 close(&mut self) -> Result<()>

Cleans up sessions, clients, cache etc.
source§

fn as_any(&self) -> &dyn Any

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§

impl Drop for ImapBackend

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere Scheme: ApproxScheme,

§

type Err = NoError

The error type produced by a failed conversion.
§

fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>

Convert the given value into an approximately equivalent representation.
§

impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,

§

type Err = <Dst as ApproxFrom<Src, Scheme>>::Err

The error type produced by a failed conversion.
§

fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>

Convert the subject into an approximately equivalent representation.
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<T> Chain<T> for T

§

fn len(&self) -> usize

The number of items that this chain link consists of.
§

fn append_to(self, v: &mut Vec<T, Global>)

Append the elements in this link to the chain.
§

impl<T, Dst> ConvAsUtil<Dst> for T

§

fn approx(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst, DefaultApprox>,

Approximate the subject with the default scheme.
§

fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject with a specific scheme.
§

impl<T> ConvUtil for T

§

fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst, DefaultApprox>,

Approximate the subject to a given type with the default scheme.
§

fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject to a given type with a specific scheme.
§

fn into_as<Dst>(self) -> Dstwhere Self: Sized + Into<Dst>,

Convert the subject to a given type.
§

fn try_as<Dst>(self) -> Result<Dst, Self::Err>where Self: Sized + TryInto<Dst>,

Attempt to convert the subject to a given type.
§

fn value_as<Dst>(self) -> Result<Dst, Self::Err>where Self: Sized + ValueInto<Dst>,

Attempt a value conversion of the subject to a given type.
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 Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<Src> TryFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
§

fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>

Convert the given value into the subject type.
source§

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

§

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.
§

impl<Src, Dst> TryInto<Dst> for Srcwhere Dst: TryFrom<Src>,

§

type Err = <Dst as TryFrom<Src>>::Err

The error type produced by a failed conversion.
§

fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>

Convert the subject into the destination type.
source§

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

§

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.
§

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

§

fn vzip(self) -> V

§

impl<Src> ValueFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
§

fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>

Convert the given value into an exactly equivalent representation.
§

impl<Src, Dst> ValueInto<Dst> for Srcwhere Dst: ValueFrom<Src>,

§

type Err = <Dst as ValueFrom<Src>>::Err

The error type produced by a failed conversion.
§

fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>

Convert the subject into an exactly equivalent representation.
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
§

impl<T> MaybeSync for T