From 2217d65201572eaae4d3d204972d4ea0e05338cb Mon Sep 17 00:00:00 2001 From: Aadi Desai <21363892+supleed2@users.noreply.github.com> Date: Thu, 7 Dec 2023 00:24:46 +0000 Subject: [PATCH] Update deps, fixes for `axum = "0.7"` --- Cargo.lock | 253 ++++++++++++++++++++++++++++++++++++++----------- Cargo.toml | 8 +- src/service.rs | 10 +- 3 files changed, 211 insertions(+), 60 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 08b8bc1..894e7ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -153,13 +153,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" dependencies = [ "async-trait", - "axum-core", + "axum-core 0.3.4", "bitflags 1.3.2", "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 0.2.10", + "http-body 0.4.5", + "hyper 0.14.27", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "sync_wrapper", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "202651474fe73c62d9e0a56c6133f7a0ff1dc1c8cf7a5b03381af2a26553ac9d" +dependencies = [ + "async-trait", + "axum-core 0.4.1", + "bytes", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.0.1", + "hyper-util", "itoa", "matchit", "memchr", @@ -187,14 +218,34 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.10", + "http-body 0.4.5", "mime", "rustversion", "tower-layer", "tower-service", ] +[[package]] +name = "axum-core" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77cb22c689c44d4c07b0ab44ebc25d69d8ae601a2f28fb8d672d344178fa17aa" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper", + "tower-layer", + "tower-service", +] + [[package]] name = "backtrace" version = "0.3.69" @@ -807,7 +858,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.10", "indexmap 1.9.3", "slab", "tokio", @@ -815,6 +866,25 @@ dependencies = [ "tracing", ] +[[package]] +name = "h2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d308f63daf4181410c242d34c11f928dcb3aa105852019e043c9d1f4e4368a" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 1.0.0", + "indexmap 2.1.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -849,7 +919,7 @@ dependencies = [ "base64 0.21.5", "bytes", "headers-core", - "http", + "http 0.2.10", "httpdate", "mime", "sha1", @@ -861,7 +931,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" dependencies = [ - "http", + "http 0.2.10", ] [[package]] @@ -923,6 +993,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.5" @@ -930,7 +1011,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", - "http", + "http 0.2.10", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.0.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +dependencies = [ + "bytes", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", "pin-project-lite", ] @@ -962,9 +1066,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.21", + "http 0.2.10", + "http-body 0.4.5", "httparse", "httpdate", "itoa", @@ -976,6 +1080,25 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "403f9214f3e703236b221f1a9cd88ec8b4adfa5296de01ab96216361f4692f56" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.0", + "http 1.0.0", + "http-body 1.0.0", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "tokio", +] + [[package]] name = "hyper-rustls" version = "0.24.2" @@ -983,8 +1106,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http", - "hyper", + "http 0.2.10", + "hyper 0.14.27", "rustls 0.21.8", "tokio", "tokio-rustls 0.24.1", @@ -996,7 +1119,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper", + "hyper 0.14.27", "pin-project-lite", "tokio", "tokio-io-timeout", @@ -1009,12 +1132,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper", + "hyper 0.14.27", "native-tls", "tokio", "tokio-native-tls", ] +[[package]] +name = "hyper-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca339002caeb0d159cc6e023dff48e199f081e42fa039895c7c6f38b37f2e9d" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "hyper 1.0.1", + "pin-project-lite", + "socket2 0.5.5", + "tokio", + "tower", + "tower-service", + "tracing", +] + [[package]] name = "iana-time-zone" version = "0.1.58" @@ -1281,7 +1424,7 @@ name = "nano" version = "0.1.0" dependencies = [ "anyhow", - "axum", + "axum 0.7.2", "indoc", "poise", "reqwest", @@ -1499,7 +1642,7 @@ checksum = "7f51189ce8be654f9b5f7e70e49967ed894e84a06fc35c6c042e64ac1fc5399e" dependencies = [ "async-trait", "bytes", - "http", + "http 0.2.10", "opentelemetry", ] @@ -1511,7 +1654,7 @@ checksum = "f24cda83b20ed2433c68241f918d0f6fdec8b1d43b7a9590ab4420c5095ca930" dependencies = [ "async-trait", "futures-core", - "http", + "http 0.2.10", "opentelemetry", "opentelemetry-proto", "opentelemetry-semantic-conventions", @@ -1936,10 +2079,10 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.21", + "http 0.2.10", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-rustls", "hyper-tls", "ipnet", @@ -2323,9 +2466,9 @@ dependencies = [ [[package]] name = "shuttle-codegen" -version = "0.34.0" +version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36d3815ee807c2563cc185c816284ddc21c9b85dbbad4adb96a6fbfcce6d35b6" +checksum = "99f584e6f02d513abb864d5a33fb24531318080385eeac6160a9ccf2988b31bb" dependencies = [ "proc-macro-error", "proc-macro2", @@ -2335,21 +2478,21 @@ dependencies = [ [[package]] name = "shuttle-common" -version = "0.34.0" +version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9264106f4bff88034fe57655a9e1bbd8ab5de91d6796f3c95197ef9ab81bcb48" +checksum = "d0406c689a1edb0d12bd813d2b245619752ce0ad6122dad35c3f08ffccd2a40c" dependencies = [ "anyhow", "async-trait", - "axum", + "axum 0.6.20", "bytes", "chrono", "comfy-table", "crossterm 0.27.0", "headers", - "http", - "http-body", - "hyper", + "http 0.2.10", + "http-body 0.4.5", + "hyper 0.14.27", "jsonwebtoken", "opentelemetry", "opentelemetry-http", @@ -2377,9 +2520,9 @@ dependencies = [ [[package]] name = "shuttle-proto" -version = "0.34.0" +version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c8e18375ee467da38bdbb8bd23f0f267f1f33ae16c3ac6659a257ca3ba96c7" +checksum = "aa63942eb5dfbc6370a82611f40254b9af28f323985d3c01be400baf729c1104" dependencies = [ "futures-core", "prost 0.12.1", @@ -2390,9 +2533,9 @@ dependencies = [ [[package]] name = "shuttle-runtime" -version = "0.34.0" +version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b492f7eead3049dcb1afc64aee03bbb8bb455ebf6e753e93d61e34d8c723dc69" +checksum = "4b8c49e755478841ae03351c3a4e7af99c684ce9757e5ddb0071d1ac42d33937" dependencies = [ "anyhow", "async-trait", @@ -2414,9 +2557,9 @@ dependencies = [ [[package]] name = "shuttle-secrets" -version = "0.34.0" +version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1a2e7a65c3b830e28e7fb9885d265455bf90ca3b419aa66b1d875e9fe42ee3" +checksum = "f0e0269b915526626e515996f77f68b433defc3be35221da87ed3eea4dce25a4" dependencies = [ "async-trait", "secrecy", @@ -2426,9 +2569,9 @@ dependencies = [ [[package]] name = "shuttle-service" -version = "0.34.0" +version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cf8dc69c29252cbd7052d49682adfd47b82530c226a3c7e884b34bf9244feac" +checksum = "b1c89dbd86fb79a791587317252daac5aa5026ed6fd73ce9f458acd30245bb13" dependencies = [ "anyhow", "async-trait", @@ -2440,9 +2583,9 @@ dependencies = [ [[package]] name = "shuttle-shared-db" -version = "0.34.0" +version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "703ebe15d531899a24ee3e4a84e969a43eb0f6c443aacfaba75c5e124bc53606" +checksum = "3af86eba0a3ed1db8a91015da1a7f08e4d22450d67e2b980c804da7827a22378" dependencies = [ "async-trait", "serde", @@ -3080,15 +3223,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" dependencies = [ "async-trait", - "axum", + "axum 0.6.20", "base64 0.21.5", "bytes", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.21", + "http 0.2.10", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-timeout", "percent-encoding", "pin-project", @@ -3109,13 +3252,13 @@ checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" dependencies = [ "async-stream", "async-trait", - "axum", + "axum 0.6.20", "base64 0.21.5", "bytes", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.21", + "http 0.2.10", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-timeout", "percent-encoding", "pin-project", @@ -3158,8 +3301,8 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "http", - "http-body", + "http 0.2.10", + "http-body 0.4.5", "http-range-header", "pin-project-lite", "tower-layer", @@ -3284,7 +3427,7 @@ dependencies = [ "base64 0.13.1", "byteorder", "bytes", - "http", + "http 0.2.10", "httparse", "log", "rand", diff --git a/Cargo.toml b/Cargo.toml index 0831158..628b07a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,14 +12,14 @@ publish = false [dependencies] anyhow = "1.0.75" -axum = "0.6.20" +axum = "0.7.2" indoc = "2.0.4" poise = "0.5.7" reqwest = { version = "0.11.22", features = ["json"] } serde = { version = "1.0.193", features = ["derive"] } -shuttle-runtime = { version = "0.34.0", default-features = false } -shuttle-secrets = "0.34.0" -shuttle-shared-db = { version = "0.34.0", features = ["postgres"] } +shuttle-runtime = { version = "0.34.1", default-features = false } +shuttle-secrets = "0.34.1" +shuttle-shared-db = { version = "0.34.1", features = ["postgres"] } sqlx = { version = "0.7.3", features = [ "macros", "postgres", diff --git a/src/service.rs b/src/service.rs index aaafff1..02690e8 100644 --- a/src/service.rs +++ b/src/service.rs @@ -8,7 +8,15 @@ pub(crate) struct NanoBot { #[shuttle_runtime::async_trait] impl shuttle_runtime::Service for NanoBot { async fn bind(mut self, addr: std::net::SocketAddr) -> Result<(), shuttle_runtime::Error> { - let serve = axum::Server::bind(&addr).serve(self.router.into_make_service()); + use std::future::IntoFuture; + + let serve = axum::serve( + shuttle_runtime::tokio::net::TcpListener::bind(addr) + .await + .map_err(shuttle_runtime::CustomError::new)?, + self.router, + ) + .into_future(); tokio::select! { _ = self.discord.run_autosharded() => {},