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

Change Handler to have an associated Future type #879

Merged
merged 2 commits into from
Mar 21, 2022

Conversation

davidpdrsn
Copy link
Member

This removes #[async_trait] from Handler and replaces that with an
associated Future type.

As hinted at in #878 I'm working on something with types that need to
implement Handler. I'm doing that by wrapping other Handler types so
I can implement Handler by simply delegating and thus don't need to
allocate another box for #[async_trait]. This change makes that
possible.

It does make Handler less ergonomic to implement but thats a very
niche feature so I'm fine with that. It wouldn't be appropriate for
FromRequest IMO.

This removes `#[async_trait]` from `Handler` and replaces that with an
associated `Future` type.

As hinted at in #878 I'm working on something with types that need to
implement `Handler`. I'm doing that by wrapping other `Handler` types so
I can implement `Handler` by simply delegating and thus don't need to
allocate another box for `#[async_trait]`. This change makes that
possible.

It does make `Handler` less ergonomic to implement but thats a very
niche feature so I'm fine with that. It wouldn't be appropriate for
`FromRequest` IMO.
@davidpdrsn davidpdrsn enabled auto-merge (squash) March 21, 2022 13:25
@davidpdrsn davidpdrsn merged commit 56e2d57 into main Mar 21, 2022
@davidpdrsn davidpdrsn deleted the handler-not-async-trait branch March 21, 2022 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants