Skip to content

Commit 1481603

Browse files
committed
Add From<()> for Body
1 parent c2ed53d commit 1481603

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/body.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ impl<'a> From<&'a str> for Body {
205205
}
206206
}
207207

208+
// TODO: add this to the mime definition.
208209
fn string_mime() -> mime::Mime {
209210
let mut mime = mime::PLAIN;
210211
let mut parameters = std::collections::HashMap::new();
@@ -223,6 +224,12 @@ impl From<Vec<u8>> for Body {
223224
}
224225
}
225226

227+
impl From<()> for Body {
228+
fn from(_: ()) -> Self {
229+
Self::empty()
230+
}
231+
}
232+
226233
impl Read for Body {
227234
#[allow(missing_doc_code_examples)]
228235
fn poll_read(

0 commit comments

Comments
 (0)