Replies: 3 comments 3 replies
-
impl<T: Serialize + Send> poem::IntoResponse for Response<T> {
...
} |
Beta Was this translation helpful? Give feedback.
-
I have extracted my app into the smallest minimal working example. I have ported this architecture into Poem + Async-GraphQL. Now I am porting it to Poem with REST API. I am having hard time in the handler part. // handler.rs
#[handler]
pub async fn find_meta(
ctx: Data<&Arc<ServerContext>>,
) -> Result<api::Response<model::Meta>, core::Error> {
let meta = ctx.meta_service.find_meta().await?;
Ok(api::Response::ok(meta.into()))
} I always get: --> src/meta/api/queries/find_meta.rs:10:1
|
10 | #[handler]
| ^^^^^^^^^^ the trait `IntoResult<_>` is not implemented for `Result<http::api::Response<model::Meta>, core::Error>` Can I keep the output signature here? Or do you have better approach/design in that integrate well with Poem? This is my app structure: rest on master [!] is 📦 v0.1.0 via 🦀 v1.58.1
❯ exa --git-ignore -T
.
├── Cargo.lock
├── Cargo.toml
├── Makefile
└── src
├── context.rs
├── errors
│ ├── core.rs
│ └── mod.rs
├── http
│ ├── api.rs
│ ├── error.rs
│ └── mod.rs
├── lib.rs
├── main.rs
└── meta
├── api
│ ├── mod.rs
│ └── queries
│ ├── find_meta.rs
│ └── mod.rs
├── entities.rs
├── mod.rs
├── model
│ └── mod.rs
└── service
├── find_meta.rs
└── mod.rs Thanks in advance. |
Beta Was this translation helpful? Give feedback.
-
You don't implement |
Beta Was this translation helpful? Give feedback.
-
Hi.
I am trying to convert this actix-web custom response into poem custom response
This is my trial:
and I got:
I changed the output type from to
Ready<Result<poem::Response, poem::Error>>
but the error persist.More context:
Sorry if the question is not related to Poem directly.
Thanks for Poem.
Beta Was this translation helpful? Give feedback.
All reactions