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

PoC async fn as a Handler #1

Closed
wants to merge 1 commit into from

Conversation

alsuren
Copy link

@alsuren alsuren commented Nov 24, 2019

This is a PoC that we gotham-rs#370 (comment) can allow async fn to impl Handler if we want to.

It's not the cleanest code. Sorry.

Hopefully it's readable enough to get the idea across.

Unfortunately, if we impl IntoHandlerFuture for F where F: SomeTrait then we cannot also impl impl IntoHandlerFuture for (State, T) (E0119), so I had to delete that impl. The only reason that we could get away with the previous pair of impls is that (State, T) and Box<HandlerFuture> are both structs, so the compiler can guarantee that it will always be able to disambiguate the two.

If we want to support the convenience (State, T) return type, we might be able to do this with a new .to_simple() function in the router builder. We might even be able to add a .to_compat() function, which takes an old-style future.

@alsuren
Copy link
Author

alsuren commented Feb 4, 2024

Just closing some old PRs. Nothing to see here.

@alsuren alsuren closed this Feb 4, 2024
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

Successfully merging this pull request may close these issues.

1 participant