aerogramme/aero-collections/mail/mod.rs

28 lines
643 B
Rust
Raw Normal View History

2022-06-29 17:24:21 +00:00
use std::convert::TryFrom;
pub mod incoming;
2022-06-29 11:16:58 +00:00
pub mod mailbox;
2024-01-05 14:36:40 +00:00
pub mod query;
2024-01-06 10:33:56 +00:00
pub mod snapshot;
pub mod uidindex;
pub mod unique_ident;
2024-02-27 17:33:49 +00:00
pub mod namespace;
2022-06-27 14:56:20 +00:00
2022-06-28 08:49:28 +00:00
// Internet Message Format
// aka RFC 822 - RFC 2822 - RFC 5322
2023-05-15 16:23:23 +00:00
// 2023-05-15 don't want to refactor this struct now.
#[allow(clippy::upper_case_acronyms)]
pub struct IMF<'a> {
raw: &'a [u8],
parsed: eml_codec::part::composite::Message<'a>,
}
2022-06-29 17:24:21 +00:00
impl<'a> TryFrom<&'a [u8]> for IMF<'a> {
type Error = ();
fn try_from(body: &'a [u8]) -> Result<IMF<'a>, ()> {
let parsed = eml_codec::parse_message(body).or(Err(()))?.1;
2022-06-29 17:24:21 +00:00
Ok(Self { raw: body, parsed })
}
}