change multipart::Part::mime() to mime_str()

The mime crate is expecting a breaking change to 0.4, so to remove the
public dependency, this method is changed to `mime_str`, which will
parse a MIME string instead.
This commit is contained in:
Sean McArthur
2018-09-11 13:38:02 -07:00
parent 99b52f949b
commit 5abf064770
2 changed files with 21 additions and 3 deletions

View File

@@ -191,11 +191,19 @@ impl Part {
}
}
/// Tries to set the mime of this part.
pub fn mime_str(mut self, mime: &str) -> ::Result<Part> {
self.mime = Some(try_!(mime.parse()));
Ok(self)
}
/* Re-enable when mime 0.4 is available, with split MediaType/MediaRange.
/// Sets the mime, builder style.
pub fn mime(mut self, mime: Mime) -> Part {
self.mime = Some(mime);
self
}
*/
/// Sets the filename, builder style.
pub fn file_name<T: Into<Cow<'static, str>>>(mut self, filename: T) -> Part {