summaryrefslogtreecommitdiffstats
path: root/src/mail.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mail.rs')
-rw-r--r--src/mail.rs35
1 files changed, 0 insertions, 35 deletions
diff --git a/src/mail.rs b/src/mail.rs
deleted file mode 100644
index c818a3d..0000000
--- a/src/mail.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-use std::path::PathBuf;
-use anyhow::Result;
-use anyhow::Error;
-use mailparse::ParsedMail;
-
-#[derive(Clone, Debug)]
-pub struct Mail {
- id: String,
- buffer: Vec<u8>,
- parsed: ParsedMail,
-}
-
-impl Mail {
- pub fn read_from_path(id: String, pb: PathBuf) -> Result<Self> {
- std::fs::read(pb)
- .map_err(Error::from)
- .and_then(|buffer| {
- mailparse::parse_mail(buffer.clone())
- .map(|parsed| (buffer, parsed))
- .map_err(Error::from)
- })
- .map(|(buffer, parsed)| Mail { id, buffer, parsed })
- }
-
- pub fn parsed(&self) -> &ParsedMail {
- &self.parsed
- }
-
- pub fn id(&self) -> &String {
- &self.id
- }
-
-}
-
-