diff --git a/libimagmail/src/mail.rs b/libimagmail/src/mail.rs index 2fde3547..897fc37e 100644 --- a/libimagmail/src/mail.rs +++ b/libimagmail/src/mail.rs @@ -3,9 +3,27 @@ use std::path::Path; use libimagstore::store::{FileLockEntry, Store}; +use mailparse::{MailParseError, ParsedMail, parse_mail}; + +use result::Result; + +struct Buffer(String); + +impl Buffer { + pub fn parsed<'a>(&'a self) -> RResult, MailParseError> { + parse_mail(self.0.as_bytes()) + } +} + +impl From for Buffer { + fn from(data: String) -> Buffer { + Buffer(data) + } +} + pub struct Mail<'a> { fle: FileLockEntry<'a>, - parsedmail: ParsedMail, + buffer: Buffer, } impl<'a> Mail<'a> {