Struct imap::types::Deleted

source ·
#[non_exhaustive]
pub struct Deleted { pub messages: DeletedMessages, pub mod_seq: Option<u64>, }
Expand description

A struct containing message sequence numbers or UID sequence sets and a mod sequence 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. If QRESYNC is enabled, the server will also return the mod sequence of the completed operation.

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

    .native_tls().unwrap();
// 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
    }
}

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§messages: DeletedMessages

The list of messages that were expunged

§mod_seq: Option<u64>

The mod sequence of the performed operation, if the QRESYNC extension is enabled.

Implementations§

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

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

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.

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.

Return if the set is empty

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.