Skip to main content

SessionState

Enum SessionState 

Source
#[non_exhaustive]
pub enum SessionState { Greeting, Ehlo, Authentication, StartTls, MailFrom, RcptTo, Data, Quit, Closed, }
Expand description

The phases of an SMTP exchange tracked by the client.

This enum is non_exhaustive so that future SMTP extensions can add new phases without forcing a major version bump.

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

Greeting

Connection has been established but the server greeting has not yet been read.

§

Ehlo

The greeting has been received but EHLO has not yet been sent (or has not yet succeeded).

§

Authentication

EHLO has succeeded. Authentication may be performed, or skipped.

§

StartTls

STARTTLS has been issued and accepted (220 from server). The transport is being upgraded; on success the state moves to Ehlo to re-issue the greeting per RFC 3207 §4.2.

§

MailFrom

Ready to issue MAIL FROM for a new transaction.

§

RcptTo

MAIL FROM has been accepted; ready to issue RCPT TO.

§

Data

At least one RCPT TO has been accepted; ready to issue DATA.

§

Quit

QUIT has been sent; the next operation is to close the transport.

§

Closed

The session is finished, either cleanly or due to a fatal error. No further SMTP operations are permitted.

Implementations§

Source§

impl SessionState

Source

pub const fn is_terminal(self) -> bool

Return true if the session is over and no further SMTP operations are permitted.

Source

pub const fn can_transition_to(self, next: Self) -> bool

Return true if next is a valid follow-on state from self.

This encodes the protocol’s ordering rules. The crate::client::SmtpClient consults this before performing any operation and returns an crate::error::InvalidInputError if the transition is not allowed.

Trait Implementations§

Source§

impl Clone for SessionState

Source§

fn clone(&self) -> SessionState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SessionState

Source§

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

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

impl Hash for SessionState

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 PartialEq for SessionState

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 Copy for SessionState

Source§

impl Eq for SessionState

Source§

impl StructuralPartialEq for SessionState

Auto Trait Implementations§

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, 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> Same for T

Source§

type Output = T

Should always be Self
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, 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.