summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerris Tseng <ferristseng@fastmail.fm>2021-02-23 23:44:34 -0500
committerFerris Tseng <ferristseng@fastmail.fm>2021-02-23 23:44:34 -0500
commitdd03b0edb4928894b64b85cc44a4984a721650c2 (patch)
treeb6ad89b14a233a97ab1c2227865fbf48170ac4c7
parent1dbab207ece88a47f92b951a83ef8d95dc40fe1c (diff)
fixing actix examples by upgrading to new rt
-rw-r--r--ipfs-api-backend-actix/Cargo.toml6
-rw-r--r--ipfs-api-backend-actix/src/backend.rs13
-rw-r--r--ipfs-api-backend-hyper/Cargo.toml2
-rw-r--r--ipfs-api-examples/Cargo.toml2
-rw-r--r--ipfs-api-prelude/Cargo.toml4
5 files changed, 10 insertions, 17 deletions
diff --git a/ipfs-api-backend-actix/Cargo.toml b/ipfs-api-backend-actix/Cargo.toml
index 22e4ba9..a0760d8 100644
--- a/ipfs-api-backend-actix/Cargo.toml
+++ b/ipfs-api-backend-actix/Cargo.toml
@@ -12,9 +12,9 @@ readme = "../README.md"
license = "MIT OR Apache-2.0"
[dependencies]
-actix-http = "2.2"
-actix-multipart-rfc7578 = "0.4"
-awc = "2.0"
+actix-http = "3.0.0-beta.2"
+actix-multipart-rfc7578 = { version = "0.5", git = "https://github.com/ferristseng/rust-multipart-rfc7578", branch = "ftseng/upgrade-actix-rt" }
+awc = "3.0.0-beta.2"
async-trait = "0.1"
bytes = "1.0"
futures = "0.3"
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()
diff --git a/ipfs-api-backend-hyper/Cargo.toml b/ipfs-api-backend-hyper/Cargo.toml
index 03ee234..d45e069 100644
--- a/ipfs-api-backend-hyper/Cargo.toml
+++ b/ipfs-api-backend-hyper/Cargo.toml
@@ -17,7 +17,7 @@ bytes = "1.0"
futures = "0.3"
http = "0.2"
hyper = { version = "0.14", features = ["http1", "http2", "client"] }
-hyper-multipart-rfc7578 = "0.5"
+hyper-multipart-rfc7578 = { version = "0.5", git = "https://github.com/ferristseng/rust-multipart-rfc7578", branch = "ftseng/upgrade-actix-rt" }
hyper-tls = "0.5"
ipfs-api-prelude = { version = "0.1.0", path = "../ipfs-api-prelude" }
serde = "1.0"
diff --git a/ipfs-api-examples/Cargo.toml b/ipfs-api-examples/Cargo.toml
index 531dc53..d8c117e 100644
--- a/ipfs-api-examples/Cargo.toml
+++ b/ipfs-api-examples/Cargo.toml
@@ -17,7 +17,7 @@ with-hyper = ["ipfs-api-backend-hyper", "tokio-hyper", "tokio-hyp
with-actix = ["ipfs-api-backend-actix", "tokio-actix", "actix-rt"]
[dependencies]
-actix-rt = { version = "1.1", optional = true }
+actix-rt = { version = "2.0", optional = true }
futures = "0.3"
ipfs-api-backend-actix = { version = "0.1", path = "../ipfs-api-backend-actix", optional = true }
ipfs-api-backend-hyper = { version = "0.1", path = "../ipfs-api-backend-hyper", optional = true }
diff --git a/ipfs-api-prelude/Cargo.toml b/ipfs-api-prelude/Cargo.toml
index 21f9088..ed2c03b 100644
--- a/ipfs-api-prelude/Cargo.toml
+++ b/ipfs-api-prelude/Cargo.toml
@@ -17,7 +17,7 @@ with-builder = ["typed-builder"]
[dependencies]
async-trait = "0.1"
bytes = "1.0"
-common-multipart-rfc7578 = "0.3.0"
+common-multipart-rfc7578 = { version = "0.3", git = "https://github.com/ferristseng/rust-multipart-rfc7578", branch = "ftseng/upgrade-actix-rt" }
dirs = "3.0"
futures = "0.3"
http = "0.2"
@@ -26,7 +26,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_urlencoded = "0.7"
thiserror = "1.0"
-tokio = "1.2"
+tokio = "1"
tokio-util = { version = "0.6", features = ["codec"] }
tracing = "0.1"
typed-builder = { version = "0.9", optional = true }