summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-07-07 18:05:08 +0200
committerMatthias Beyer <mail@beyermatthias.de>2020-07-07 18:05:08 +0200
commit9b7b5f57806818aa1724fa330ac845cbe4cb6259 (patch)
treef1f000baede67a1c3770360a06c5d0215191cfa4 /src
parentec1715903cae7e08e5371a1f7ce7593a03050537 (diff)
impl Deref for Mail, to be able to ask maildir::MailEntry for data
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src')
-rw-r--r--src/mailstore.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mailstore.rs b/src/mailstore.rs
index 1d35c20..d5bdc3b 100644
--- a/src/mailstore.rs
+++ b/src/mailstore.rs
@@ -1,3 +1,4 @@
+use std::ops::Deref;
use std::path::PathBuf;
use std::iter::FromIterator;
use anyhow::Result;
@@ -16,7 +17,6 @@ impl MailStore {
MailStoreBuilder {
cur: Box::new(md.list_cur().map(|m| Mail::cur_from(m?))),
new: Box::new(md.list_new().map(|m| Mail::new_from(m?))),
- md,
}
}
@@ -49,7 +49,6 @@ impl FromIterator<Mail> for MailStore {
}
pub struct MailStoreBuilder {
- md: Maildir,
cur: Box<dyn Iterator<Item = Result<Mail>>>,
new: Box<dyn Iterator<Item = Result<Mail>>>,
}
@@ -107,3 +106,12 @@ impl Mail {
self.mailtype == MailType::Cur
}
}
+
+impl Deref for Mail {
+ type Target = MailEntry;
+
+ fn deref(&self) -> &Self::Target {
+ &self.entry
+ }
+}
+