From 44f92b2e50e287c1b2b41bf8ed36c5e886acd938 Mon Sep 17 00:00:00 2001 From: Paul Otten Date: Tue, 16 Jan 2024 12:28:19 -0500 Subject: [PATCH 1/2] feat: support poem v2.0.0 --- services/shuttle-poem/Cargo.toml | 10 ++++++++-- services/shuttle-poem/README.md | 9 +++++++++ services/shuttle-poem/src/lib.rs | 5 +++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/services/shuttle-poem/Cargo.toml b/services/shuttle-poem/Cargo.toml index 89462d24b..299b15475 100644 --- a/services/shuttle-poem/Cargo.toml +++ b/services/shuttle-poem/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "shuttle-poem" -version = "0.36.0" +version = "0.36.1" edition = "2021" license = "Apache-2.0" description = "Service implementation to run a poem webserver on shuttle" @@ -9,8 +9,14 @@ keywords = ["shuttle-service", "poem"] [workspace] [dependencies] -poem = { version = "1.3.55" } +poem-1 = { package = "poem", version = "1.3.55", optional = true } +poem-2 = { package = "poem", version = "2.0.0", optional = true } shuttle-runtime = { path = "../../runtime", version = "0.36.0", default-features = false } [dev-dependencies] tokio = { version = "1.26.0", features = ["macros", "rt-multi-thread"] } + +[features] +default = ["poem-1"] + +poem-2 = ["dep:poem-2"] diff --git a/services/shuttle-poem/README.md b/services/shuttle-poem/README.md index 7062b1e38..612daec27 100644 --- a/services/shuttle-poem/README.md +++ b/services/shuttle-poem/README.md @@ -1,5 +1,14 @@ ## Shuttle service integration for the Poem web framework. +Poem 1.* is used by default. + +Poem 2.* is supported by using these feature flags: + +```toml,ignore +poem = "2.0.0" +shuttle-poem = { version = "0.36.1", default-features = false, features = ["poem-2"] } +``` + ### Example ```rust,no_run diff --git a/services/shuttle-poem/src/lib.rs b/services/shuttle-poem/src/lib.rs index abe38ede0..dc7aeb838 100644 --- a/services/shuttle-poem/src/lib.rs +++ b/services/shuttle-poem/src/lib.rs @@ -2,6 +2,11 @@ /// A wrapper type for [poem::Endpoint] so we can implement [shuttle_runtime::Service] for it. pub struct PoemService(pub T); +#[cfg(feature = "poem-1")] +use poem_1 as poem; +#[cfg(feature = "poem-2")] +use poem_2 as poem; + #[shuttle_runtime::async_trait] impl shuttle_runtime::Service for PoemService where From 5f8506d6e10a894b6c7ead9ae377a2bedebc9e2b Mon Sep 17 00:00:00 2001 From: Paul Otten Date: Tue, 16 Jan 2024 14:59:07 -0500 Subject: [PATCH 2/2] Remove backward compatibility for Poem 1, increase shuttle-poem version to 0.37.0 --- services/shuttle-poem/Cargo.toml | 10 ++-------- services/shuttle-poem/README.md | 9 --------- services/shuttle-poem/src/lib.rs | 5 ----- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/services/shuttle-poem/Cargo.toml b/services/shuttle-poem/Cargo.toml index 299b15475..a46d5895f 100644 --- a/services/shuttle-poem/Cargo.toml +++ b/services/shuttle-poem/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "shuttle-poem" -version = "0.36.1" +version = "0.37.0" edition = "2021" license = "Apache-2.0" description = "Service implementation to run a poem webserver on shuttle" @@ -9,14 +9,8 @@ keywords = ["shuttle-service", "poem"] [workspace] [dependencies] -poem-1 = { package = "poem", version = "1.3.55", optional = true } -poem-2 = { package = "poem", version = "2.0.0", optional = true } +poem = { version = "2.0.0" } shuttle-runtime = { path = "../../runtime", version = "0.36.0", default-features = false } [dev-dependencies] tokio = { version = "1.26.0", features = ["macros", "rt-multi-thread"] } - -[features] -default = ["poem-1"] - -poem-2 = ["dep:poem-2"] diff --git a/services/shuttle-poem/README.md b/services/shuttle-poem/README.md index 612daec27..7062b1e38 100644 --- a/services/shuttle-poem/README.md +++ b/services/shuttle-poem/README.md @@ -1,14 +1,5 @@ ## Shuttle service integration for the Poem web framework. -Poem 1.* is used by default. - -Poem 2.* is supported by using these feature flags: - -```toml,ignore -poem = "2.0.0" -shuttle-poem = { version = "0.36.1", default-features = false, features = ["poem-2"] } -``` - ### Example ```rust,no_run diff --git a/services/shuttle-poem/src/lib.rs b/services/shuttle-poem/src/lib.rs index dc7aeb838..abe38ede0 100644 --- a/services/shuttle-poem/src/lib.rs +++ b/services/shuttle-poem/src/lib.rs @@ -2,11 +2,6 @@ /// A wrapper type for [poem::Endpoint] so we can implement [shuttle_runtime::Service] for it. pub struct PoemService(pub T); -#[cfg(feature = "poem-1")] -use poem_1 as poem; -#[cfg(feature = "poem-2")] -use poem_2 as poem; - #[shuttle_runtime::async_trait] impl shuttle_runtime::Service for PoemService where