Hyper: try_concat() stopped working in alpha.2 ?

Created on 25 Sep 2019  路  3Comments  路  Source: hyperium/hyper

   |     let body = match resp.into_body().try_concat().await {
   |                                       ^^^^^^^^^^ method not found in `hyper::body::body::Body`
   |
   = note: the method `try_concat` exists but the following trait bounds were not satisfied:
           `&hyper::body::body::Body : futures_util::try_stream::TryStreamExt`
           `&mut hyper::body::body::Body : futures_util::try_stream::TryStreamExt`
           `hyper::body::body::Body : futures_util::try_stream::TryStreamExt`

Most helpful comment

Looks like adding "unstable-stream" feature helps. Closing this.

All 3 comments

Looks like adding "unstable-stream" feature helps. Closing this.

It seems like this stopped working again since the bytes 0.5 crate removed Extend<u8> from Bytes.

This is the best I could come up with so far, but this seems very much like a workaround:

let bytes = request.into_body()
    .and_then(move |bytes| async { Ok(BytesMut::from_iter(bytes)) })
    .try_concat()
    .await?
    .to_vec();

Does anyone have a better solution?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

janus picture janus  路  21Comments

habnabit picture habnabit  路  20Comments

seanmonstar picture seanmonstar  路  23Comments

JosephShering picture JosephShering  路  22Comments

bagder picture bagder  路  32Comments