struct HtmlMsgParser {
pub html: String,
pub plain: Option<PlainText>,
pub(crate) msg_html: String,
}
Expand description
HtmlMsgParser converts a mime-message to HTML.
Fields§
§html: String
§plain: Option<PlainText>
§msg_html: String
Implementations§
source§impl HtmlMsgParser
impl HtmlMsgParser
sourcepub async fn from_bytes<'a>(
context: &Context,
rawmime: &'a [u8],
) -> Result<(Self, ParsedMail<'a>)>
pub async fn from_bytes<'a>( context: &Context, rawmime: &'a [u8], ) -> Result<(Self, ParsedMail<'a>)>
Function takes a raw mime-message string, searches for the main-text part and returns that as parser.html
sourceasync fn collect_texts_recursive<'a>(
&'a mut self,
context: &'a Context,
mail: &'a ParsedMail<'a>,
) -> Result<()>
async fn collect_texts_recursive<'a>( &'a mut self, context: &'a Context, mail: &'a ParsedMail<'a>, ) -> Result<()>
Function iterates over all mime-parts and searches for text/plain and text/html parts and saves the first one found. in the corresponding structure fields.
Usually, there is at most one plain-text and one HTML-text part, multiple plain-text parts might be used for mailinglist-footers, therefore we use the first one.
sourceasync fn cid_to_data_recursive<'a>(
&'a mut self,
context: &'a Context,
mail: &'a ParsedMail<'a>,
) -> Result<()>
async fn cid_to_data_recursive<'a>( &'a mut self, context: &'a Context, mail: &'a ParsedMail<'a>, ) -> Result<()>
Replace cid:-protocol by the data:-protocol where appropriate. This allows the final html-file to be self-contained.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HtmlMsgParser
impl RefUnwindSafe for HtmlMsgParser
impl Send for HtmlMsgParser
impl Sync for HtmlMsgParser
impl Unpin for HtmlMsgParser
impl UnwindSafe for HtmlMsgParser
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more