Introduce feature-gated `serde` dependency

* derive `serde::{Deserialize, Serialize}` for `Capability` and `AuthMechanism`.
This commit is contained in:
Damian Poddebniak 2021-05-22 22:56:55 +02:00
parent 7cac2a2903
commit 21138c353b
2 changed files with 11 additions and 0 deletions

View File

@ -10,6 +10,13 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = []
serdex = ["serde"]
[dependencies]
nom = "6"
abnf-core = "0.4.0"
# Optional
serde = { version = "1.0", features = ["derive"], optional = true }

View File

@ -1,4 +1,6 @@
use crate::utils::escape_quoted;
#[cfg(feature = "serdex")]
use serde::{Deserialize, Serialize};
use std::io::Write;
#[derive(Clone, Debug, PartialEq, Eq)]
@ -321,6 +323,7 @@ impl EhloOkResp {
// -------------------------------------------------------------------------------------------------
#[cfg_attr(feature = "serdex", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Capability {
// Send as mail [RFC821]
@ -502,6 +505,7 @@ impl Capability {
}
}
#[cfg_attr(feature = "serdex", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum AuthMechanism {
Plain,