diff options
author | Ferris Tseng <ferristseng@fastmail.fm> | 2021-02-23 23:44:34 -0500 |
---|---|---|
committer | Ferris Tseng <ferristseng@fastmail.fm> | 2021-02-23 23:44:34 -0500 |
commit | dd03b0edb4928894b64b85cc44a4984a721650c2 (patch) | |
tree | b6ad89b14a233a97ab1c2227865fbf48170ac4c7 /ipfs-api-backend-actix/src | |
parent | 1dbab207ece88a47f92b951a83ef8d95dc40fe1c (diff) |
fixing actix examples by upgrading to new rt
Diffstat (limited to 'ipfs-api-backend-actix/src')
-rw-r--r-- | ipfs-api-backend-actix/src/backend.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/ipfs-api-backend-actix/src/backend.rs b/ipfs-api-backend-actix/src/backend.rs index 73fdf0b..fbbc6a4 100644 --- a/ipfs-api-backend-actix/src/backend.rs +++ b/ipfs-api-backend-actix/src/backend.rs @@ -86,15 +86,13 @@ impl Backend for ActixBackend { let body = res.body().await?; // FIXME: Actix compat with bytes 1.0 - Ok((status, Bytes::copy_from_slice(body.as_ref()))) + Ok((status, body)) } fn response_to_byte_stream( res: Self::HttpResponse, ) -> Box<dyn Stream<Item = Result<Bytes, Self::Error>> + Unpin> { - let stream = res - .map_ok(|bytes| Bytes::copy_from_slice(bytes.as_ref())) - .err_into(); + let stream = res.err_into(); Box::new(stream) } @@ -120,12 +118,7 @@ impl Backend for ActixBackend { _ => res .body() .map(|maybe_body| match maybe_body { - Ok(body) => { - // FIXME: Actix compat with bytes 1.0 - let body = Bytes::copy_from_slice(body.as_ref()); - - Err(Self::process_error_from_body(body)) - } + Ok(body) => Err(Self::process_error_from_body(body)), Err(e) => Err(e.into()), }) .into_stream() |