Added len() to PartType.

This commit is contained in:
Mauro D
2022-10-13 16:57:15 +00:00
parent b653d6fa3d
commit 7b08027955
+11
View File
@@ -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<DateTime> for i64 {
fn from(value: DateTime) -> Self {
value.to_timestamp()