try high level fx
This commit is contained in:
parent
efe037aa25
commit
6e2b29ec57
2 changed files with 17 additions and 35 deletions
19
src/error.rs
19
src/error.rs
|
@ -1,21 +1,6 @@
|
||||||
use nom;
|
use nom;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub enum IMFError<'a> {
|
pub enum EMLError<'a> {
|
||||||
Segment(nom::Err<nom::error::Error<&'a [u8]>>),
|
ParseError(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>>),
|
|
||||||
}
|
}
|
||||||
|
|
33
src/lib.rs
33
src/lib.rs
|
@ -1,21 +1,18 @@
|
||||||
pub mod error;
|
mod error;
|
||||||
pub mod text;
|
mod text;
|
||||||
pub mod header;
|
mod header;
|
||||||
pub mod rfc5322;
|
mod rfc5322;
|
||||||
pub mod mime;
|
mod mime;
|
||||||
pub mod part;
|
mod part;
|
||||||
|
|
||||||
/*
|
pub fn email(input: &[u8]) -> Result<part::part::Message, error::EMLError> {
|
||||||
use crate::part;
|
part::part::message(mime::mime::Message::default())(input)
|
||||||
use crate::mime;
|
.map(|(_, v)| v)
|
||||||
use crate::rfc5322 as imf;
|
.map_err(error::EMLError::ParseError)
|
||||||
use crate::header;
|
|
||||||
|
|
||||||
pub fn email(input: &[u8]) -> Result<part::part::Message> {
|
|
||||||
message(mime::mime::Message::default())(input).map(|(_, v)| v)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn imf(input: &[u8]) -> Result<imf::message::Message> {
|
pub fn imf(input: &[u8]) -> Result<rfc5322::message::Message, error::EMLError> {
|
||||||
header::header(imf::field::field)
|
rfc5322::field::message(input)
|
||||||
map(header(field), |v| FieldList(v.known()).message())(fullmail)
|
.map(|(_, v)| v)
|
||||||
}*/
|
.map_err(error::EMLError::ParseError)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue