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

Remove buffer from BoxRoute #270

Merged
merged 1 commit into from
Aug 26, 2021
Merged

Remove buffer from BoxRoute #270

merged 1 commit into from
Aug 26, 2021

Conversation

davidpdrsn
Copy link
Member

Boxing a service normally means using tower::util::BoxService. That
doesn't implement Clone however so normally I had been combining it
with Buffer to get that.

But recently I discovered https://github.com/dtolnay/dyn-clone which
makes it possible to clone trait objects. So this adds a new internal
utility called CloneBoxService which replaces the previous
BoxService + Buffer combo in BoxRoute.

I'll investigate upstreaming that to tower. I think it makes sense there
since box + clone is quite a common need.

Boxing a service normally means using `tower::util::BoxService`. That
doesn't implement `Clone` however so normally I had been combining it
with `Buffer` to get that.

But recently I discovered https://github.com/dtolnay/dyn-clone which
makes it possible to clone trait objects. So this adds a new internal
utility called `CloneBoxService` which replaces the previous
`BoxService` + `Buffer` combo in `BoxRoute`.

I'll investigate upstreaming that to tower. I think it makes sense there
since box + clone is quite a common need.
@davidpdrsn davidpdrsn added the C-cleanup Category: PRs that clean code up or issues documenting cleanup. label Aug 26, 2021
@davidpdrsn davidpdrsn enabled auto-merge (squash) August 26, 2021 06:27
@davidpdrsn davidpdrsn merged commit 552d69e into main Aug 26, 2021
@davidpdrsn davidpdrsn deleted the clone-box-service branch August 26, 2021 06:34
davidpdrsn added a commit that referenced this pull request Aug 26, 2021
davidpdrsn added a commit that referenced this pull request Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant