pub enum Code<'a> {
Show 16 variants Alert, BadCharset { allowed: Vec<Charset<'a>>, }, Capability(NonEmptyVec<Capability<'a>>), Parse, PermanentFlags(Vec<FlagPerm<'a>>), ReadOnly, ReadWrite, TryCreate, UidNext(NonZeroU32), UidValidity(NonZeroU32), Unseen(NonZeroU32), Referral(Cow<'a, str>), CompressionActive, OverQuota, TooBig, Other(CodeOther<'a>),
}
Expand description

A response code consists of data inside square brackets in the form of an atom, possibly followed by a space and arguments. The response code contains additional information or status codes for client software beyond the OK/NO/BAD condition, and are defined when there is a specific action that a client can take based upon the additional information.

The currently defined response codes are:

Variants§

§

Alert

ALERT

The human-readable text contains a special alert that MUST be presented to the user in a fashion that calls the user’s attention to the message.

§

BadCharset

Fields

§allowed: Vec<Charset<'a>>

BADCHARSET

Optionally followed by a parenthesized list of charsets. A SEARCH failed because the given charset is not supported by this implementation. If the optional list of charsets is given, this lists the charsets that are supported by this implementation.

§

Capability(NonEmptyVec<Capability<'a>>)

CAPABILITY

Followed by a list of capabilities. This can appear in the initial OK or PREAUTH response to transmit an initial capabilities list. This makes it unnecessary for a client to send a separate CAPABILITY command if it recognizes this response.

§

Parse

PARSE

The human-readable text represents an error in parsing the [RFC-2822] header or [MIME-IMB] headers of a message in the mailbox.

§

PermanentFlags(Vec<FlagPerm<'a>>)

PERMANENTFLAGS

Followed by a parenthesized list of flags, indicates which of the known flags the client can change permanently. Any flags that are in the FLAGS untagged response, but not the PERMANENTFLAGS list, can not be set permanently. If the client attempts to STORE a flag that is not in the PERMANENTFLAGS list, the server will either ignore the change or store the state change for the remainder of the current session only. The PERMANENTFLAGS list can also include the special flag *, which indicates that it is possible to create new keywords by attempting to store those flags in the mailbox.

§

ReadOnly

READ-ONLY

The mailbox is selected read-only, or its access while selected has changed from read-write to read-only.

§

ReadWrite

READ-WRITE

The mailbox is selected read-write, or its access while selected has changed from read-only to read-write.

§

TryCreate

TRYCREATE

An APPEND or COPY attempt is failing because the target mailbox does not exist (as opposed to some other reason). This is a hint to the client that the operation can succeed if the mailbox is first created by the CREATE command.

§

UidNext(NonZeroU32)

UIDNEXT

Followed by a decimal number, indicates the next unique identifier value. Refer to section 2.3.1.1 for more information.

§

UidValidity(NonZeroU32)

UIDVALIDITY

Followed by a decimal number, indicates the unique identifier validity value. Refer to section 2.3.1.1 for more information.

§

Unseen(NonZeroU32)

UNSEEN

Followed by a decimal number, indicates the number of the first message without the \Seen flag set.

§

Referral(Cow<'a, str>)

Available on crate features ext_mailbox_referrals or ext_login_referrals only.

IMAP4 Login Referrals (RFC 2221)

§

CompressionActive

Available on crate feature ext_compress only.
§

OverQuota

Available on crate feature ext_quota only.

SHOULD be returned in the tagged NO response to an APPEND/COPY/MOVE when the addition of the message(s) puts the target mailbox over any one of its quota limits.

§

TooBig

Available on crate feature ext_literal only.

Server got a non-synchronizing literal larger than 4096 bytes.

§

Other(CodeOther<'a>)

Additional response codes defined by particular client or server implementations SHOULD be prefixed with an “X” until they are added to a revision of this protocol. Client implementations SHOULD ignore response codes that they do not recognize.


atom [SP 1*<any TEXT-CHAR except "]">]`

Note: We use this as a fallback for everything that was not recognized as Code. This includes, e.g., variants with missing parameters, etc.

Implementations§

source§

impl<'a> Code<'a>

source

pub fn badcharset(allowed: Vec<Charset<'a>>) -> Self

source

pub fn capability<C>(caps: C) -> Result<Self, C::Error>where C: TryInto<NonEmptyVec<Capability<'a>>>,

source

pub fn permanentflags(flags: Vec<FlagPerm<'a>>) -> Self

source

pub fn uidnext(uidnext: u32) -> Result<Self, TryFromIntError>

source

pub fn uidvalidity(uidnext: u32) -> Result<Self, TryFromIntError>

source

pub fn unseen(uidnext: u32) -> Result<Self, TryFromIntError>

Trait Implementations§

source§

impl<'a, 'arbitrary: 'a> Arbitrary<'arbitrary> for Code<'a>

source§

fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
source§

fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
source§

impl<'a> Clone for Code<'a>

source§

fn clone(&self) -> Code<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Code<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de, 'a> Deserialize<'de> for Code<'a>

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<'a> Hash for Code<'a>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a> IntoBoundedStatic for Code<'a>

§

type Static = Code<'static>

The target type is bounded by the 'static lifetime.
source§

fn into_static(self) -> Self::Static

Convert an owned T into an owned T such that T: 'static.
source§

impl<'a> PartialEq<Code<'a>> for Code<'a>

source§

fn eq(&self, other: &Code<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Serialize for Code<'a>

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<'a> ToBoundedStatic for Code<'a>

§

type Static = Code<'static>

The target type is bounded by the 'static lifetime.
source§

fn to_static(&self) -> Self::Static

Convert an &T to an owned T such that T: 'static.
source§

impl<'a> Eq for Code<'a>

source§

impl<'a> StructuralEq for Code<'a>

source§

impl<'a> StructuralPartialEq for Code<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Code<'a>

§

impl<'a> Send for Code<'a>

§

impl<'a> Sync for Code<'a>

§

impl<'a> Unpin for Code<'a>

§

impl<'a> UnwindSafe for Code<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
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
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
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.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,