1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
use super::dispatch::DispatchMail; use crate::dir::FileTransport; use samotop_core::{common::*, mail::*}; use std::path::PathBuf; #[derive(Debug)] pub struct Dir { pub path: PathBuf, } impl Dir { pub fn new(path: PathBuf) -> Result<Dir> { Ok(Dir { path }) } } impl MailSetup for Dir { fn setup(self, builder: &mut Builder) { let transport = FileTransport::new(self.path); builder .dispatch .insert(0, Box::new(DispatchMail::new(transport))) } }