Add doc comments for all status subcodes

This commit is contained in:
Nathan Fisher 2023-05-24 13:22:47 -04:00
parent 4a40603efc
commit 73375abec3
2 changed files with 20 additions and 2 deletions

View file

@ -1,6 +1,7 @@
use std::fmt; use std::fmt;
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
/// The receiving server sent an unrecognized or invalid status code
pub struct Error; pub struct Error;
impl fmt::Display for Error { impl fmt::Display for Error {

View file

@ -117,13 +117,20 @@ impl TryFrom<u8> for TemporaryFailure {
} }
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
/// Status codes representing that a permanent failure has occurred and the sending server should /// Status codes representing that a permanent failure has occurred and the sending
/// not resend the message. /// server should not resend the message.
pub enum PermanentFailure { pub enum PermanentFailure {
/// Something is wrong with the mailserver, and you should not try to resend
/// your message.
PermanentError = 0, PermanentError = 0,
/// The mailbox you are trying to send to doesn't exist, and the mailserver
/// won't accept your message.
MailboxNonexistent = 1, MailboxNonexistent = 1,
/// The mailbox you are trying to send to existed once, but doesn't anymore.
MailboxGone = 2, MailboxGone = 2,
/// This mailserver doesn't serve mail for the hostname you provided.
DomainNotServiced = 3, DomainNotServiced = 3,
/// Your request is malformed, and won't be accepted by the mailserver.
BadRequest = 9, BadRequest = 9,
Other, Other,
} }
@ -147,10 +154,20 @@ impl TryFrom<u8> for PermanentFailure {
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
/// Status codes representing an authentication failure /// Status codes representing an authentication failure
pub enum AuthenticationFailure { pub enum AuthenticationFailure {
/// This mailserver doesn't accept anonymous mail, and you need to repeat your
/// request with a certificate.
CertificateRequired = 0, CertificateRequired = 0,
/// Your certificate was validated, but you are not allowed to send mail to
/// that mailbox.
UnauthorizedSender = 1, UnauthorizedSender = 1,
/// Your certificate might be legitimate, but it has a problem - it is expired,
/// or it doesn't point to a valid Misfin identity, etc.
CertificateInvalid = 2, CertificateInvalid = 2,
/// Your certificate matches an identity that the mailserver recognizes, but
/// the fingerprint has changed, so it is rejecting your message.
IdentityMismatch = 3, IdentityMismatch = 3,
/// The mailserver needs you to complete a task to confirm that you are a
/// legitimate sender. (This is reserved for a Hashcash style anti-spam measure).
ProofRequired = 4, ProofRequired = 4,
Other, Other,
} }