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

Gotham IntoResponse feature? #175

Closed
kellenff opened this issue Dec 10, 2018 · 4 comments
Closed

Gotham IntoResponse feature? #175

kellenff opened this issue Dec 10, 2018 · 4 comments

Comments

@kellenff
Copy link
Contributor

My favorite stack includes both this crate and the gotham web framework. It'd be awesome to have an implementation of its IntoResponse trait to make rendering that much simpler and ergonomic. I'm happy to work on this feature and submit a pull request, but wanted to make sure this would be of interest as a crate feature.

@djc
Copy link
Collaborator

djc commented Dec 10, 2018

Sure, bring it on! Search for "rocket" or "iron" to see all the pieces on how to put it all together.

@zzau13
Copy link
Contributor

zzau13 commented Dec 10, 2018

Gotham is a hyper wrapper, really functionality is not Gotham but hyper. So it would make more sense in the feature with-hyper. The current implementation #179 , removing the references to Gotham, would work for both Hyper and Gotham cases.

@kellenff
Copy link
Contributor Author

@botika The distinction is that gotham::IntoResponse is not implemented for Into<hyper::Response<hyper::Body>>, so if Template were to implement the latter instead, Template::into would have to be called manually:

struct FooBar;

impl Into<hyper::Response<hyper::Body>> for Foobar { ... }

fn hello(state: State) -> (State, impl IntoResponse) {
    (state, FooBar{}.into())
}

@zzau13
Copy link
Contributor

zzau13 commented Dec 10, 2018

Ok, thanks

@zzau13 zzau13 closed this as completed Dec 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants