Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support poem v2.0.0 #1520

Merged
merged 2 commits into from Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions 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"
Expand All @@ -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"]
paulotten marked this conversation as resolved.
Show resolved Hide resolved

poem-2 = ["dep:poem-2"]
9 changes: 9 additions & 0 deletions 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
Expand Down
5 changes: 5 additions & 0 deletions services/shuttle-poem/src/lib.rs
Expand Up @@ -2,6 +2,11 @@
/// A wrapper type for [poem::Endpoint] so we can implement [shuttle_runtime::Service] for it.
pub struct PoemService<T>(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<T> shuttle_runtime::Service for PoemService<T>
where
Expand Down