feat(builder): Add a content-type method

for SinglePart
This commit is contained in:
Alexis Mousset
2020-05-08 23:57:51 +02:00
parent 83a0310c8c
commit ce08d9e8aa

View File

@@ -62,6 +62,12 @@ impl SinglePartBuilder {
self self
} }
/// Set the Content-Type header of the singlepart
pub fn content_type(mut self, content_type: ContentType) -> Self {
self.headers.set(content_type);
self
}
/// Build singlepart using body /// Build singlepart using body
pub fn body<T: Into<Vec<u8>>>(self, body: T) -> SinglePart { pub fn body<T: Into<Vec<u8>>>(self, body: T) -> SinglePart {
SinglePart { SinglePart {
@@ -81,11 +87,8 @@ impl Default for SinglePartBuilder {
/// ///
/// # Example /// # Example
/// ///
/// ```no_test /// ```
/// extern crate mime; /// use lettre::message::{SinglePart, header};
/// extern crate emailmessage;
///
/// use emailmessage::{SinglePart, header};
/// ///
/// let part = SinglePart::builder() /// let part = SinglePart::builder()
/// .header(header::ContentType("text/plain; charset=utf8".parse().unwrap())) /// .header(header::ContentType("text/plain; charset=utf8".parse().unwrap()))