From 7b0802795536aaf076e3b7a0356cc2b3b4569f80 Mon Sep 17 00:00:00 2001 From: Mauro D Date: Thu, 13 Oct 2022 16:57:15 +0000 Subject: [PATCH] Added len() to PartType. --- src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 9a05fb2..cd5224a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1726,6 +1726,17 @@ impl<'x> ContentType<'x> { } } +impl<'x> PartType<'x> { + pub fn len(&self) -> usize { + match self { + PartType::Text(v) | PartType::Html(v) => v.len(), + PartType::Binary(v) | PartType::InlineBinary(v) => v.len(), + PartType::Message(v) => v.raw_message.len(), + PartType::Multipart(_) => 0, + } + } +} + impl From for i64 { fn from(value: DateTime) -> Self { value.to_timestamp()