aboutsummaryrefslogtreecommitdiff
path: root/aero-collections/mail/mod.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-03-08 08:17:03 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-03-08 08:17:03 +0100
commit1a43ce5ac7033c148f64a033f2b1d335e95e11d5 (patch)
tree60b234604170fe207248458a9c4cdd3f4b7c36f2 /aero-collections/mail/mod.rs
parentbb9cb386b65834c44cae86bd100f800883022062 (diff)
downloadaerogramme-1a43ce5ac7033c148f64a033f2b1d335e95e11d5.tar.gz
aerogramme-1a43ce5ac7033c148f64a033f2b1d335e95e11d5.zip
WIP refactor
Diffstat (limited to 'aero-collections/mail/mod.rs')
-rw-r--r--aero-collections/mail/mod.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/aero-collections/mail/mod.rs b/aero-collections/mail/mod.rs
new file mode 100644
index 0000000..03e85cd
--- /dev/null
+++ b/aero-collections/mail/mod.rs
@@ -0,0 +1,27 @@
+use std::convert::TryFrom;
+
+pub mod incoming;
+pub mod mailbox;
+pub mod query;
+pub mod snapshot;
+pub mod uidindex;
+pub mod unique_ident;
+pub mod namespace;
+
+// Internet Message Format
+// aka RFC 822 - RFC 2822 - RFC 5322
+// 2023-05-15 don't want to refactor this struct now.
+#[allow(clippy::upper_case_acronyms)]
+pub struct IMF<'a> {
+ raw: &'a [u8],
+ parsed: eml_codec::part::composite::Message<'a>,
+}
+
+impl<'a> TryFrom<&'a [u8]> for IMF<'a> {
+ type Error = ();
+
+ fn try_from(body: &'a [u8]) -> Result<IMF<'a>, ()> {
+ let parsed = eml_codec::parse_message(body).or(Err(()))?.1;
+ Ok(Self { raw: body, parsed })
+ }
+}