feat(body): add body::aggregate and body::to_bytes functions

Adds utility functions to `hyper::body` to help asynchronously
collecting all the buffers of some `HttpBody` into one.

- `aggregate` will collect all into an `impl Buf` without copying the
  contents. This is ideal if you don't need a contiguous buffer.
- `to_bytes` will copy all the data into a single contiguous `Bytes`
  buffer.
This commit is contained in:
Sean McArthur
2019-12-05 17:51:37 -08:00
parent 5a59875742
commit 8ba9a8d2c4
15 changed files with 282 additions and 128 deletions

View File

@@ -98,7 +98,7 @@ required-features = ["runtime"]
[[example]]
name = "client_json"
path = "examples/client_json.rs"
required-features = ["runtime", "stream"]
required-features = ["runtime"]
[[example]]
name = "echo"
@@ -162,6 +162,11 @@ path = "examples/web_api.rs"
required-features = ["runtime", "stream"]
[[bench]]
name = "body"
path = "benches/body.rs"
required-features = ["runtime", "stream"]
[[bench]]
name = "connect"
path = "benches/connect.rs"