feat(http): add Default trait to Body

server::Request has a mandatory Body and client::Request has an optional Body.
Having a default for Body makes it easier to merge the two.
This commit is contained in:
Nick Gonzales
2017-05-01 11:45:15 -06:00
parent df1095dfe7
commit f61708ba81

View File

@@ -34,6 +34,12 @@ impl Default for Body {
}
}
impl Default for Body {
fn default() -> Body {
Body::empty()
}
}
impl Stream for Body {
type Item = Chunk;
type Error = ::Error;
@@ -107,6 +113,12 @@ impl From<&'static str> for Body {
}
}
impl From<Option<Body>> for Body {
fn from (body: Option<Body>) -> Body {
body.unwrap_or_default()
}
}
fn _assert_send_sync() {
fn _assert_send<T: Send>() {}
fn _assert_sync<T: Sync>() {}