style(all): rename 'serde-impls' feature to 'serde'
This makes lettre behave like the rest of the libraries, where the `serde` feature enables serde support
This commit is contained in:
@@ -45,8 +45,7 @@ harness = false
|
|||||||
default = ["file-transport", "smtp-transport", "sendmail-transport", "builder"]
|
default = ["file-transport", "smtp-transport", "sendmail-transport", "builder"]
|
||||||
builder = ["email", "mime", "time", "base64", "uuid"]
|
builder = ["email", "mime", "time", "base64", "uuid"]
|
||||||
unstable = []
|
unstable = []
|
||||||
serde-impls = ["serde"]
|
file-transport = ["serde", "serde_json"]
|
||||||
file-transport = ["serde-impls", "serde_json"]
|
|
||||||
smtp-transport = ["bufstream", "native-tls", "base64", "nom", "hostname"]
|
smtp-transport = ["bufstream", "native-tls", "base64", "nom", "hostname"]
|
||||||
sendmail-transport = []
|
sendmail-transport = []
|
||||||
connection-pool = ["r2d2"]
|
connection-pool = ["r2d2"]
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ pub mod error;
|
|||||||
|
|
||||||
/// Writes the content and the envelope information to a file
|
/// Writes the content and the envelope information to a file
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct FileTransport {
|
pub struct FileTransport {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ impl FileTransport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
struct SerializableEmail {
|
struct SerializableEmail {
|
||||||
envelope: Envelope,
|
envelope: Envelope,
|
||||||
message_id: String,
|
message_id: String,
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ use std::str::FromStr;
|
|||||||
|
|
||||||
/// Email address
|
/// Email address
|
||||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct EmailAddress(String);
|
pub struct EmailAddress(String);
|
||||||
|
|
||||||
impl EmailAddress {
|
impl EmailAddress {
|
||||||
@@ -96,7 +96,7 @@ impl AsRef<OsStr> for EmailAddress {
|
|||||||
///
|
///
|
||||||
/// We only accept mailboxes, and do not support source routes (as per RFC).
|
/// We only accept mailboxes, and do not support source routes (as per RFC).
|
||||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct Envelope {
|
pub struct Envelope {
|
||||||
/// The envelope recipients' addresses
|
/// The envelope recipients' addresses
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ pub mod error;
|
|||||||
|
|
||||||
/// Sends an email using the `sendmail` command
|
/// Sends an email using the `sendmail` command
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct SendmailTransport {
|
pub struct SendmailTransport {
|
||||||
command: String,
|
command: String,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ impl<S: Into<String>, T: Into<String>> IntoCredentials for (S, T) {
|
|||||||
|
|
||||||
/// Contains user credentials
|
/// Contains user credentials
|
||||||
#[derive(PartialEq, Eq, Clone, Hash, Debug)]
|
#[derive(PartialEq, Eq, Clone, Hash, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct Credentials {
|
pub struct Credentials {
|
||||||
authentication_identity: String,
|
authentication_identity: String,
|
||||||
secret: String,
|
secret: String,
|
||||||
@@ -49,7 +49,7 @@ impl Credentials {
|
|||||||
|
|
||||||
/// Represents authentication mechanisms
|
/// Represents authentication mechanisms
|
||||||
#[derive(PartialEq, Eq, Copy, Clone, Hash, Debug)]
|
#[derive(PartialEq, Eq, Copy, Clone, Hash, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum Mechanism {
|
pub enum Mechanism {
|
||||||
/// PLAIN authentication mechanism
|
/// PLAIN authentication mechanism
|
||||||
/// RFC 4616: https://tools.ietf.org/html/rfc4616
|
/// RFC 4616: https://tools.ietf.org/html/rfc4616
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use std::fmt::{self, Display, Formatter};
|
|||||||
|
|
||||||
/// EHLO command
|
/// EHLO command
|
||||||
#[derive(PartialEq, Clone, Debug)]
|
#[derive(PartialEq, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct EhloCommand {
|
pub struct EhloCommand {
|
||||||
client_id: ClientId,
|
client_id: ClientId,
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ impl EhloCommand {
|
|||||||
|
|
||||||
/// STARTTLS command
|
/// STARTTLS command
|
||||||
#[derive(PartialEq, Clone, Debug, Copy)]
|
#[derive(PartialEq, Clone, Debug, Copy)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct StarttlsCommand;
|
pub struct StarttlsCommand;
|
||||||
|
|
||||||
impl Display for StarttlsCommand {
|
impl Display for StarttlsCommand {
|
||||||
@@ -45,7 +45,7 @@ impl Display for StarttlsCommand {
|
|||||||
|
|
||||||
/// MAIL command
|
/// MAIL command
|
||||||
#[derive(PartialEq, Clone, Debug)]
|
#[derive(PartialEq, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct MailCommand {
|
pub struct MailCommand {
|
||||||
sender: Option<EmailAddress>,
|
sender: Option<EmailAddress>,
|
||||||
parameters: Vec<MailParameter>,
|
parameters: Vec<MailParameter>,
|
||||||
@@ -74,7 +74,7 @@ impl MailCommand {
|
|||||||
|
|
||||||
/// RCPT command
|
/// RCPT command
|
||||||
#[derive(PartialEq, Clone, Debug)]
|
#[derive(PartialEq, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct RcptCommand {
|
pub struct RcptCommand {
|
||||||
recipient: EmailAddress,
|
recipient: EmailAddress,
|
||||||
parameters: Vec<RcptParameter>,
|
parameters: Vec<RcptParameter>,
|
||||||
@@ -102,7 +102,7 @@ impl RcptCommand {
|
|||||||
|
|
||||||
/// DATA command
|
/// DATA command
|
||||||
#[derive(PartialEq, Clone, Debug, Copy)]
|
#[derive(PartialEq, Clone, Debug, Copy)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct DataCommand;
|
pub struct DataCommand;
|
||||||
|
|
||||||
impl Display for DataCommand {
|
impl Display for DataCommand {
|
||||||
@@ -113,7 +113,7 @@ impl Display for DataCommand {
|
|||||||
|
|
||||||
/// QUIT command
|
/// QUIT command
|
||||||
#[derive(PartialEq, Clone, Debug, Copy)]
|
#[derive(PartialEq, Clone, Debug, Copy)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct QuitCommand;
|
pub struct QuitCommand;
|
||||||
|
|
||||||
impl Display for QuitCommand {
|
impl Display for QuitCommand {
|
||||||
@@ -124,7 +124,7 @@ impl Display for QuitCommand {
|
|||||||
|
|
||||||
/// NOOP command
|
/// NOOP command
|
||||||
#[derive(PartialEq, Clone, Debug, Copy)]
|
#[derive(PartialEq, Clone, Debug, Copy)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct NoopCommand;
|
pub struct NoopCommand;
|
||||||
|
|
||||||
impl Display for NoopCommand {
|
impl Display for NoopCommand {
|
||||||
@@ -135,7 +135,7 @@ impl Display for NoopCommand {
|
|||||||
|
|
||||||
/// HELP command
|
/// HELP command
|
||||||
#[derive(PartialEq, Clone, Debug)]
|
#[derive(PartialEq, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct HelpCommand {
|
pub struct HelpCommand {
|
||||||
argument: Option<String>,
|
argument: Option<String>,
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ impl HelpCommand {
|
|||||||
|
|
||||||
/// VRFY command
|
/// VRFY command
|
||||||
#[derive(PartialEq, Clone, Debug)]
|
#[derive(PartialEq, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct VrfyCommand {
|
pub struct VrfyCommand {
|
||||||
argument: String,
|
argument: String,
|
||||||
}
|
}
|
||||||
@@ -180,7 +180,7 @@ impl VrfyCommand {
|
|||||||
|
|
||||||
/// EXPN command
|
/// EXPN command
|
||||||
#[derive(PartialEq, Clone, Debug)]
|
#[derive(PartialEq, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct ExpnCommand {
|
pub struct ExpnCommand {
|
||||||
argument: String,
|
argument: String,
|
||||||
}
|
}
|
||||||
@@ -201,7 +201,7 @@ impl ExpnCommand {
|
|||||||
|
|
||||||
/// RSET command
|
/// RSET command
|
||||||
#[derive(PartialEq, Clone, Debug, Copy)]
|
#[derive(PartialEq, Clone, Debug, Copy)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct RsetCommand;
|
pub struct RsetCommand;
|
||||||
|
|
||||||
impl Display for RsetCommand {
|
impl Display for RsetCommand {
|
||||||
@@ -212,7 +212,7 @@ impl Display for RsetCommand {
|
|||||||
|
|
||||||
/// AUTH command
|
/// AUTH command
|
||||||
#[derive(PartialEq, Clone, Debug)]
|
#[derive(PartialEq, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct AuthCommand {
|
pub struct AuthCommand {
|
||||||
mechanism: Mechanism,
|
mechanism: Mechanism,
|
||||||
credentials: Credentials,
|
credentials: Credentials,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const DEFAULT_DOMAIN_CLIENT_ID: &str = "localhost";
|
|||||||
|
|
||||||
/// Client identifier, the parameter to `EHLO`
|
/// Client identifier, the parameter to `EHLO`
|
||||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum ClientId {
|
pub enum ClientId {
|
||||||
/// A fully-qualified domain name
|
/// A fully-qualified domain name
|
||||||
Domain(String),
|
Domain(String),
|
||||||
@@ -54,7 +54,7 @@ impl ClientId {
|
|||||||
|
|
||||||
/// Supported ESMTP keywords
|
/// Supported ESMTP keywords
|
||||||
#[derive(PartialEq, Eq, Hash, Copy, Clone, Debug)]
|
#[derive(PartialEq, Eq, Hash, Copy, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum Extension {
|
pub enum Extension {
|
||||||
/// 8BITMIME keyword
|
/// 8BITMIME keyword
|
||||||
///
|
///
|
||||||
@@ -85,7 +85,7 @@ impl Display for Extension {
|
|||||||
|
|
||||||
/// Contains information about an SMTP server
|
/// Contains information about an SMTP server
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct ServerInfo {
|
pub struct ServerInfo {
|
||||||
/// Server name
|
/// Server name
|
||||||
///
|
///
|
||||||
@@ -178,7 +178,7 @@ impl ServerInfo {
|
|||||||
|
|
||||||
/// A `MAIL FROM` extension parameter
|
/// A `MAIL FROM` extension parameter
|
||||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum MailParameter {
|
pub enum MailParameter {
|
||||||
/// `BODY` parameter
|
/// `BODY` parameter
|
||||||
Body(MailBodyParameter),
|
Body(MailBodyParameter),
|
||||||
@@ -215,7 +215,7 @@ impl Display for MailParameter {
|
|||||||
|
|
||||||
/// Values for the `BODY` parameter to `MAIL FROM`
|
/// Values for the `BODY` parameter to `MAIL FROM`
|
||||||
#[derive(PartialEq, Eq, Clone, Debug, Copy)]
|
#[derive(PartialEq, Eq, Clone, Debug, Copy)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum MailBodyParameter {
|
pub enum MailBodyParameter {
|
||||||
/// `7BIT`
|
/// `7BIT`
|
||||||
SevenBit,
|
SevenBit,
|
||||||
@@ -234,7 +234,7 @@ impl Display for MailBodyParameter {
|
|||||||
|
|
||||||
/// A `RCPT TO` extension parameter
|
/// A `RCPT TO` extension parameter
|
||||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum RcptParameter {
|
pub enum RcptParameter {
|
||||||
/// Custom parameter
|
/// Custom parameter
|
||||||
Other {
|
Other {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use std::fmt::{Display, Formatter, Result as FmtResult};
|
|||||||
|
|
||||||
/// Encode a string as xtext
|
/// Encode a string as xtext
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[cfg_attr(feature = "serde-impls", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct XText<'a>(pub &'a str);
|
pub struct XText<'a>(pub &'a str);
|
||||||
|
|
||||||
impl<'a> Display for XText<'a> {
|
impl<'a> Display for XText<'a> {
|
||||||
|
|||||||
Reference in New Issue
Block a user