Enum imap::types::Deleted[][src]

pub enum Deleted {
    Expunged(Vec<Seq>),
    Vanished(Vec<RangeInclusive<Uid>>),
}

An enum representing message sequence numbers or UID sequence sets returned in response to a EXPUNGE command.

The EXPUNGE command may return several EXPUNGE responses referencing message sequence numbers, or it may return a VANISHED response referencing multiple UID values in a sequence set if the client has enabled QRESYNC.

Deleted implements some iterators to make it easy to use. If the caller knows that they should be receiving an EXPUNGE or VANISHED response, then they can use seqs() to get an iterator over EXPUNGE message sequence numbers, or uids() to get an iterator over the VANISHED UIDs. As a convenience Deleted also implents IntoIterator which just returns an iterator over whatever is contained within.

Examples

// Iterate over whatever is returned
if let Ok(deleted) = session.expunge() {
    for id in &deleted {
        // Do something with id
    }
}

// Expect a VANISHED response with UIDs
if let Ok(deleted) = session.expunge() {
    for uid in deleted.uids() {
        // Do something with uid
    }
}

Variants

Expunged(Vec<Seq>)

Message sequence numbers given in an EXPUNGE response.

Vanished(Vec<RangeInclusive<Uid>>)

Message UIDs given in a VANISHED response.

Implementations

impl Deleted[src]

pub fn from_expunged(v: Vec<u32>) -> Self[src]

Construct a new Deleted value from a vector of message sequence numbers returned in one or more EXPUNGE responses.

pub fn from_vanished(v: Vec<RangeInclusive<u32>>) -> Self[src]

Construct a new Deleted value from a sequence-set of UIDs returned in a VANISHED response

pub fn seqs(&self) -> impl Iterator<Item = Seq> + '_[src]

Return an iterator over message sequence numbers from an EXPUNGE response. If the client is expecting sequence numbers this function can be used to ensure only sequence numbers returned in an EXPUNGE response are processed.

pub fn uids(&self) -> impl Iterator<Item = Uid> + '_[src]

Return an iterator over UIDs returned in a VANISHED response. If the client is expecting UIDs this function can be used to ensure only UIDs are processed.

pub fn is_empty(&self) -> bool[src]

Return if the set is empty

Trait Implementations

impl Clone for Deleted[src]

impl Debug for Deleted[src]

impl<'a> IntoIterator for &'a Deleted[src]

type Item = u32

The type of the elements being iterated over.

type IntoIter = Box<dyn Iterator<Item = u32> + 'a>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl RefUnwindSafe for Deleted

impl Send for Deleted

impl Sync for Deleted

impl Unpin for Deleted

impl UnwindSafe for Deleted

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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