Run rustfmt
This commit is contained in:
@@ -16,10 +16,7 @@ pub mod error;
|
||||
|
||||
/// Writes the content and the envelope information to a file
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct FileTransport {
|
||||
path: PathBuf,
|
||||
}
|
||||
@@ -34,10 +31,7 @@ impl FileTransport {
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
struct SerializableEmail {
|
||||
envelope: Envelope,
|
||||
message_id: String,
|
||||
|
||||
@@ -44,10 +44,7 @@ use std::str::FromStr;
|
||||
|
||||
/// Email address
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct EmailAddress(String);
|
||||
|
||||
impl EmailAddress {
|
||||
@@ -97,10 +94,7 @@ impl AsRef<OsStr> for EmailAddress {
|
||||
///
|
||||
/// We only accept mailboxes, and do not support source routes (as per RFC).
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct Envelope {
|
||||
/// The envelope recipients' addresses
|
||||
///
|
||||
|
||||
@@ -14,10 +14,7 @@ pub mod error;
|
||||
|
||||
/// Sends an email using the `sendmail` command
|
||||
#[derive(Debug, Default)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct SendmailTransport {
|
||||
command: String,
|
||||
}
|
||||
|
||||
@@ -31,10 +31,7 @@ impl<S: Into<String>, T: Into<String>> IntoCredentials for (S, T) {
|
||||
|
||||
/// Contains user credentials
|
||||
#[derive(PartialEq, Eq, Clone, Hash, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct Credentials {
|
||||
authentication_identity: String,
|
||||
secret: String,
|
||||
@@ -52,10 +49,7 @@ impl Credentials {
|
||||
|
||||
/// Represents authentication mechanisms
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Hash, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum Mechanism {
|
||||
/// PLAIN authentication mechanism
|
||||
/// RFC 4616: https://tools.ietf.org/html/rfc4616
|
||||
|
||||
@@ -18,10 +18,7 @@ pub mod net;
|
||||
|
||||
/// The codec used for transparency
|
||||
#[derive(Default, Clone, Copy, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct ClientCodec {
|
||||
escape_count: u8,
|
||||
}
|
||||
|
||||
@@ -13,10 +13,7 @@ use std::fmt::{self, Display, Formatter};
|
||||
|
||||
/// EHLO command
|
||||
#[derive(PartialEq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct EhloCommand {
|
||||
client_id: ClientId,
|
||||
}
|
||||
@@ -36,10 +33,7 @@ impl EhloCommand {
|
||||
|
||||
/// STARTTLS command
|
||||
#[derive(PartialEq, Clone, Debug, Copy)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct StarttlsCommand;
|
||||
|
||||
impl Display for StarttlsCommand {
|
||||
@@ -50,10 +44,7 @@ impl Display for StarttlsCommand {
|
||||
|
||||
/// MAIL command
|
||||
#[derive(PartialEq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct MailCommand {
|
||||
sender: Option<EmailAddress>,
|
||||
parameters: Vec<MailParameter>,
|
||||
@@ -82,10 +73,7 @@ impl MailCommand {
|
||||
|
||||
/// RCPT command
|
||||
#[derive(PartialEq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct RcptCommand {
|
||||
recipient: EmailAddress,
|
||||
parameters: Vec<RcptParameter>,
|
||||
@@ -113,10 +101,7 @@ impl RcptCommand {
|
||||
|
||||
/// DATA command
|
||||
#[derive(PartialEq, Clone, Debug, Copy)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct DataCommand;
|
||||
|
||||
impl Display for DataCommand {
|
||||
@@ -127,10 +112,7 @@ impl Display for DataCommand {
|
||||
|
||||
/// QUIT command
|
||||
#[derive(PartialEq, Clone, Debug, Copy)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct QuitCommand;
|
||||
|
||||
impl Display for QuitCommand {
|
||||
@@ -141,10 +123,7 @@ impl Display for QuitCommand {
|
||||
|
||||
/// NOOP command
|
||||
#[derive(PartialEq, Clone, Debug, Copy)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct NoopCommand;
|
||||
|
||||
impl Display for NoopCommand {
|
||||
@@ -155,10 +134,7 @@ impl Display for NoopCommand {
|
||||
|
||||
/// HELP command
|
||||
#[derive(PartialEq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct HelpCommand {
|
||||
argument: Option<String>,
|
||||
}
|
||||
@@ -182,10 +158,7 @@ impl HelpCommand {
|
||||
|
||||
/// VRFY command
|
||||
#[derive(PartialEq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct VrfyCommand {
|
||||
argument: String,
|
||||
}
|
||||
@@ -206,10 +179,7 @@ impl VrfyCommand {
|
||||
|
||||
/// EXPN command
|
||||
#[derive(PartialEq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct ExpnCommand {
|
||||
argument: String,
|
||||
}
|
||||
@@ -229,10 +199,7 @@ impl ExpnCommand {
|
||||
|
||||
/// RSET command
|
||||
#[derive(PartialEq, Clone, Debug, Copy)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct RsetCommand;
|
||||
|
||||
impl Display for RsetCommand {
|
||||
@@ -243,10 +210,7 @@ impl Display for RsetCommand {
|
||||
|
||||
/// AUTH command
|
||||
#[derive(PartialEq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct AuthCommand {
|
||||
mechanism: Mechanism,
|
||||
credentials: Credentials,
|
||||
|
||||
@@ -14,10 +14,7 @@ const DEFAULT_DOMAIN_CLIENT_ID: &str = "localhost";
|
||||
|
||||
/// Client identifier, the parameter to `EHLO`
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum ClientId {
|
||||
/// A fully-qualified domain name
|
||||
Domain(String),
|
||||
@@ -57,10 +54,7 @@ impl ClientId {
|
||||
|
||||
/// Supported ESMTP keywords
|
||||
#[derive(PartialEq, Eq, Hash, Copy, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum Extension {
|
||||
/// 8BITMIME keyword
|
||||
///
|
||||
@@ -91,10 +85,7 @@ impl Display for Extension {
|
||||
|
||||
/// Contains information about an SMTP server
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct ServerInfo {
|
||||
/// Server name
|
||||
///
|
||||
@@ -187,10 +178,7 @@ impl ServerInfo {
|
||||
|
||||
/// A `MAIL FROM` extension parameter
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum MailParameter {
|
||||
/// `BODY` parameter
|
||||
Body(MailBodyParameter),
|
||||
@@ -227,10 +215,7 @@ impl Display for MailParameter {
|
||||
|
||||
/// Values for the `BODY` parameter to `MAIL FROM`
|
||||
#[derive(PartialEq, Eq, Clone, Debug, Copy)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum MailBodyParameter {
|
||||
/// `7BIT`
|
||||
SevenBit,
|
||||
@@ -249,10 +234,7 @@ impl Display for MailBodyParameter {
|
||||
|
||||
/// A `RCPT TO` extension parameter
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum RcptParameter {
|
||||
/// Custom parameter
|
||||
Other {
|
||||
|
||||
@@ -65,10 +65,7 @@ pub enum ClientSecurity {
|
||||
|
||||
/// Configures connection reuse behavior
|
||||
#[derive(Clone, Debug, Copy)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum ConnectionReuseParameters {
|
||||
/// Unlimited connection reuse
|
||||
ReuseUnlimited,
|
||||
|
||||
@@ -17,10 +17,7 @@ use std::string::ToString;
|
||||
|
||||
/// First digit indicates severity
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum Severity {
|
||||
/// 2yx
|
||||
PositiveCompletion = 2,
|
||||
@@ -40,10 +37,7 @@ impl Display for Severity {
|
||||
|
||||
/// Second digit
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum Category {
|
||||
/// x0z
|
||||
Syntax = 0,
|
||||
@@ -67,10 +61,7 @@ impl Display for Category {
|
||||
|
||||
/// The detail digit of a response code (third digit)
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum Detail {
|
||||
#[allow(missing_docs)]
|
||||
Zero = 0,
|
||||
@@ -102,10 +93,7 @@ impl Display for Detail {
|
||||
|
||||
/// Represents a 3 digit SMTP response code
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct Code {
|
||||
/// First digit of the response code
|
||||
pub severity: Severity,
|
||||
@@ -136,10 +124,7 @@ impl Code {
|
||||
///
|
||||
/// The text message is optional, only the code is mandatory
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct Response {
|
||||
/// Response code
|
||||
pub code: Code,
|
||||
|
||||
@@ -4,10 +4,7 @@ use std::fmt::{Display, Formatter, Result as FmtResult};
|
||||
|
||||
/// Encode a string as xtext
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde-impls",
|
||||
derive(serde::Serialize, serde::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct XText<'a>(pub &'a str);
|
||||
|
||||
impl<'a> Display for XText<'a> {
|
||||
|
||||
Reference in New Issue
Block a user