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:
@@ -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>() {}
|
||||
|
||||
Reference in New Issue
Block a user