Skip to content

Commit f0d3be8

Browse files
committed
Change signature of set_mime
1 parent abefece commit f0d3be8

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

src/body.rs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -486,29 +486,14 @@ impl Body {
486486
/// use http_types::mime;
487487
///
488488
/// let mut body = Body::empty();
489-
/// body.set_mime(mime::CSS);
489+
/// body.set_mime(Some(mime::CSS));
490490
/// assert_eq!(body.mime(), Some(&mime::CSS));
491-
/// ```
492-
pub fn set_mime(&mut self, mime: impl Into<Mime>) {
493-
self.mime = Some(mime.into());
494-
}
495-
496-
/// Unsets the mime type of this Body.
497491
///
498-
/// # Examples
492+
/// body.set_mime(None);
493+
/// assert_eq!(body.mime(), None);
499494
/// ```
500-
/// use http_types::Body;
501-
/// use http_types::mime;
502-
///
503-
/// let mut body = Body::empty();
504-
/// assert!(body.mime().is_some());
505-
///
506-
/// body.unset_mime();
507-
/// assert!(body.mime().is_none());
508-
/// ```
509-
///
510-
pub fn unset_mime(&mut self) {
511-
self.mime = None
495+
pub fn set_mime(&mut self, mime: Option<Mime>) {
496+
self.mime = mime;
512497
}
513498

514499
/// Create a Body by chaining another Body after this one, consuming both.

0 commit comments

Comments
 (0)