http-rs / http-rs/tide

Implementing IntoResponse for tide::Result<tide::Response>

Open
#371 5 comments 4 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
5.1k
Forks
329
PR merge metrics
No merged PRs in 30d

Description

Hey!

I have started to port https://github.com/colinbankier/realworld-tide from `v0.3.0` to `v0.4.0` - so far so good, no major issues.

I noticed that `cargo build` fails if I try to mount a route with following signature:
```rust
pub async fn list_articles(cx: Request) -> tide::Result {
[...]
}
```
with the following error
```
error[E0277]: the trait bound `std::result::Result: tide::response::into_response::IntoResponse` is not satisfied
--> src/main.rs:28:29
|
28 | api.at("/articles").get(web::articles::list_articles);
| ^^^ the trait `tide::response::into_response::IntoResponse` is not implemented for `std::result::Result`
|
= note: required because of the requirements on the impl of `tide::endpoint::Endpoint>` for `fn(tide::request::Request>) -> impl core::future::future::Future {web::articles::list_articles}`
```

I'd be happy to submit a PR to implement `IntoResponse` for `tide::Result`, but I'd like to understand first if this implementation is missing on purpose due to some pending discussions around error handling in `tide` :grin:

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.