Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 16 variants Io(Arc<Error>), Auth { text: String, code: Option<ResponseCode>, }, No { text: String, code: Option<ResponseCode>, }, Bad { text: String, code: Option<ResponseCode>, }, Bye { text: String, code: Option<ResponseCode>, }, Protocol(String), Parse(String), Timeout, Closed, StartTlsUnavailable, MissingCapability(String), AppendLimit { size: u64, limit: u64, }, InvalidAppendDate(String), Internal(String), DriverPanicked(String), DriverGone,
}
Expand description

Error type for IMAP client operations.

Implements Serialize/Deserialize behind the serde feature flag. The Io variant is serialized as its ErrorKind name and message string; on deserialization an std::io::Error is reconstructed from these fields.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Io(Arc<Error>)

Underlying I/O error, including TLS transport errors (RFC 3501 Section 2.1).

Wrapped in Arc so that Error can implement Clone.

§

Auth

Authentication was rejected by the server (RFC 3501 Section 6.2.2).

The optional ResponseCode carries the structured reason code (e.g., [AUTHENTICATIONFAILED], [EXPIRED], [PRIVACYREQUIRED]) when the server provides one (RFC 5530 Section 3).

Fields

§text: String

Human-readable response text.

§code: Option<ResponseCode>

Structured response code, if present (RFC 5530 Section 3).

§

No

Server returned a NO response to a command (RFC 3501 Section 7.1.2).

The optional ResponseCode carries the structured reason code (e.g., [NOPERM], [OVERQUOTA]) when the server provides one (RFC 5530 Section 3).

Fields

§text: String

Human-readable response text.

§code: Option<ResponseCode>

Structured response code, if present (RFC 5530 Section 3).

§

Bad

Server returned a BAD response — client sent something invalid (RFC 3501 Section 7.1.3).

The optional ResponseCode carries the structured reason code when the server provides one (RFC 5530 Section 3).

Fields

§text: String

Human-readable response text.

§code: Option<ResponseCode>

Structured response code, if present (RFC 5530 Section 3).

§

Bye

Server sent BYE — closing connection (RFC 3501 Section 7.1.5).

BYE responses can include response codes such as [ALERT] or [UNAVAILABLE] that carry actionable information for the client (RFC 3501 Section 7.1.5, RFC 5530 Section 3). The [ALERT] code in particular MUST be presented to the user (RFC 3501 Section 7.1).

Fields

§text: String

Human-readable response text.

§code: Option<ResponseCode>

Structured response code, if present (RFC 5530 Section 3).

§

Protocol(String)

IMAP protocol violation by the server (RFC 3501 Section 7 / RFC 9051 Section 7).

§

Parse(String)

Failed to parse a server response (RFC 3501 Section 7 / RFC 9051 Section 7).

§

Timeout

Operation exceeded the caller-supplied timeout.

This is a client-imposed constraint, not a protocol-level error. See RFC 3501 Section 5.4 for the server-side autologout timer; client-side timeouts guard against indefinite blocking on I/O.

§

Closed

The TCP connection has been closed (RFC 3501 Section 2.1).

§

StartTlsUnavailable

STARTTLS was requested but the server does not advertise it (RFC 3501 Section 6.2.1, RFC 9051 Section 6.2.1).

§

MissingCapability(String)

A capability required for the requested operation is not advertised (RFC 3501 Section 6.1.1).

§

AppendLimit

Message exceeds the server’s advertised APPENDLIMIT (RFC 7889 Section 3).

Fields

§size: u64

Size of the message the caller tried to append (RFC 7889 Section 3).

§limit: u64

Server-advertised maximum in octets (RFC 7889 Section 5).

§

InvalidAppendDate(String)

The date-time string supplied to APPEND does not conform to the date-time production in RFC 3501 Section 9.

date-time      = DQUOTE date-day-fixed "-" date-month "-" date-year
                 SP time SP zone DQUOTE
date-day-fixed = (SP DIGIT) / 2DIGIT
date-month     = "Jan" / "Feb" / ... / "Dec"
time           = 2DIGIT ":" 2DIGIT ":" 2DIGIT
zone           = ("+" / "-") 4DIGIT
§

Internal(String)

Internal driver error — the driver task stub has not been replaced by its full implementation yet, or an invariant was violated that indicates a bug in the library.

§

DriverPanicked(String)

The driver task panicked. The payload is the panic message extracted from the JoinError (best-effort — non-string panics produce a generic description).

§

DriverGone

The driver task exited (cleanly or via cancellation) and the command channel is closed, but no panic was observed.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

Returns a duplicate 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 Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for Error

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<ValidationError> for Error

Source§

fn from(e: ValidationError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Error

Compares two IMAP errors for equality.

The Io variant compares by std::io::ErrorKind only, since std::io::Error does not implement PartialEq. Two Io errors with the same ErrorKind are considered equal even if their messages differ.

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Error

Auto Trait Implementations§

§

impl Freeze for Error

§

impl !RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl !UnwindSafe for Error

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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<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