Some cleanup

This commit is contained in:
Benedikt Terhechte 2021-10-10 08:05:56 +02:00
parent 471517047a
commit 158b6995a7
2 changed files with 7 additions and 16 deletions

View File

@ -1,14 +0,0 @@
use eyre::Result;
use super::super::shared::filesystem::{emails_in, folders_in};
use super::super::MessageSender;
use super::raw_email::RawEmailEntry;
use crate::types::Config;
pub fn read_emails(config: &Config, sender: MessageSender) -> Result<Vec<RawEmailEntry>> {
Ok(folders_in(
&config.emails_folder_path,
sender,
|path, sender| emails_in(path, sender, RawEmailEntry::new),
)?)
}

View File

@ -1,8 +1,9 @@
mod filesystem;
mod meta;
mod raw_email;
use super::shared::filesystem::{emails_in, folders_in};
use super::{Config, ImporterFormat, MessageSender, Result};
use raw_email::RawEmailEntry;
#[derive(Default)]
pub struct Gmail {}
@ -10,6 +11,10 @@ pub struct Gmail {}
impl ImporterFormat for Gmail {
type Item = raw_email::RawEmailEntry;
fn emails(&self, config: &Config, sender: MessageSender) -> Result<Vec<Self::Item>> {
filesystem::read_emails(config, sender)
Ok(folders_in(
&config.emails_folder_path,
sender,
|path, sender| emails_in(path, sender, RawEmailEntry::new),
)?)
}
}