From e39724159e6545f0c9a9a714e750d043322eb240 Mon Sep 17 00:00:00 2001 From: Mauro D Date: Wed, 31 Jan 2024 18:31:14 -0300 Subject: [PATCH] v0.1.4 --- Cargo.toml | 7 ++++++- src/lib.rs | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 05a55e2..fb7e3f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,9 +8,14 @@ license = "Apache-2.0 OR MIT" keywords = ["smtp", "lmtp", "protocol", "parser"] categories = ["email", "parser-implementations"] readme = "README.md" -version = "0.1.3" +version = "0.1.4" edition = "2021" [dependencies] +serde = { version = "1.0", features = ["derive"], optional = true } [dev-dependencies] + +[features] +default = [] +serde_support = ["serde"] diff --git a/src/lib.rs b/src/lib.rs index cf94124..ce7fabc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,6 +52,9 @@ pub mod request; pub mod response; mod tokens; +#[cfg(feature = "serde_support")] +use serde::{Deserialize, Serialize}; + #[derive(Debug, Clone, PartialEq, Eq)] pub enum Request { Ehlo { host: T }, @@ -219,6 +222,7 @@ pub struct EhloResponse { } #[derive(Debug, Clone, PartialEq, Eq)] +#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] pub struct Response { pub code: u16, pub esc: [u8; 3],