expose naive fields
This commit is contained in:
parent
8b17af73fa
commit
0a7179a17c
2 changed files with 18 additions and 0 deletions
|
@ -49,6 +49,16 @@ pub enum AnyMIME<'a> {
|
||||||
Txt(MIME<'a, r#type::DeductibleText>),
|
Txt(MIME<'a, r#type::DeductibleText>),
|
||||||
Bin(MIME<'a, r#type::Binary>),
|
Bin(MIME<'a, r#type::Binary>),
|
||||||
}
|
}
|
||||||
|
impl<'a> AnyMIME<'a> {
|
||||||
|
pub fn fields(&self) -> &NaiveMIME<'a> {
|
||||||
|
match self {
|
||||||
|
Self::Mult(v) => &v.fields,
|
||||||
|
Self::Msg(v) => &v.fields,
|
||||||
|
Self::Txt(v) => &v.fields,
|
||||||
|
Self::Bin(v) => &v.fields,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a, T: WithDefaultType> From<AnyMIMEWithDefault<'a, T>> for AnyMIME<'a> {
|
impl<'a, T: WithDefaultType> From<AnyMIMEWithDefault<'a, T>> for AnyMIME<'a> {
|
||||||
fn from(a: AnyMIMEWithDefault<'a, T>) -> Self {
|
fn from(a: AnyMIMEWithDefault<'a, T>) -> Self {
|
||||||
|
|
|
@ -58,6 +58,14 @@ impl<'a> AnyPart<'a> {
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub fn mime(self) -> &NaiveMIME<'a> {
|
||||||
|
match self {
|
||||||
|
Self::Mult(v) => &v.mime.fields,
|
||||||
|
Self::Msg(v) => &v.mime.fields,
|
||||||
|
Self::Txt(v) => &v.mime.fields,
|
||||||
|
Self::Bin(v) => &v.mime.fields,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl<'a> From<Multipart<'a>> for AnyPart<'a> {
|
impl<'a> From<Multipart<'a>> for AnyPart<'a> {
|
||||||
fn from(m: Multipart<'a>) -> Self {
|
fn from(m: Multipart<'a>) -> Self {
|
||||||
|
|
Loading…
Reference in a new issue