try high level fx

This commit is contained in:
Quentin 2023-07-23 16:36:01 +02:00
parent efe037aa25
commit 6e2b29ec57
Signed by: quentin
GPG key ID: E9602264D639FF68
2 changed files with 17 additions and 35 deletions

View file

@ -1,21 +1,6 @@
use nom;
#[derive(Debug, PartialEq)]
pub enum IMFError<'a> {
Segment(nom::Err<nom::error::Error<&'a [u8]>>),
ExtractFields(nom::Err<nom::error::Error<&'a str>>),
DateTimeParse(nom::Err<nom::error::Error<&'a str>>),
DateTimeLogic,
Mailbox(nom::Err<nom::error::Error<&'a str>>),
MailboxList(nom::Err<nom::error::Error<&'a str>>),
AddressList(nom::Err<nom::error::Error<&'a str>>),
NullableAddressList(nom::Err<nom::error::Error<&'a str>>),
MessageID(nom::Err<nom::error::Error<&'a str>>),
MessageIDList(nom::Err<nom::error::Error<&'a str>>),
Unstructured(nom::Err<nom::error::Error<&'a str>>),
PhraseList(nom::Err<nom::error::Error<&'a str>>),
ReceivedLog(nom::Err<nom::error::Error<&'a str>>),
Version(nom::Err<nom::error::Error<&'a str>>),
ContentType(nom::Err<nom::error::Error<&'a str>>),
Mechanism(nom::Err<nom::error::Error<&'a str>>),
pub enum EMLError<'a> {
ParseError(nom::Err<nom::error::Error<&'a [u8]>>),
}

View file

@ -1,21 +1,18 @@
pub mod error;
pub mod text;
pub mod header;
pub mod rfc5322;
pub mod mime;
pub mod part;
mod error;
mod text;
mod header;
mod rfc5322;
mod mime;
mod part;
/*
use crate::part;
use crate::mime;
use crate::rfc5322 as imf;
use crate::header;
pub fn email(input: &[u8]) -> Result<part::part::Message> {
message(mime::mime::Message::default())(input).map(|(_, v)| v)
pub fn email(input: &[u8]) -> Result<part::part::Message, error::EMLError> {
part::part::message(mime::mime::Message::default())(input)
.map(|(_, v)| v)
.map_err(error::EMLError::ParseError)
}
pub fn imf(input: &[u8]) -> Result<imf::message::Message> {
header::header(imf::field::field)
map(header(field), |v| FieldList(v.known()).message())(fullmail)
}*/
pub fn imf(input: &[u8]) -> Result<rfc5322::message::Message, error::EMLError> {
rfc5322::field::message(input)
.map(|(_, v)| v)
.map_err(error::EMLError::ParseError)
}