-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat(server): Remove into_service api #1996
base: master
Are you sure you want to change the base?
Conversation
@@ -897,6 +897,7 @@ impl<L> Router<L> { | |||
} | |||
|
|||
/// Create a tower service out of a router. | |||
#[deprecated(since = "0.12.4", note = "compose the layers and the `Routes`")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So how would you spell this in 0.13?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose? Should this api be kept in 0.13?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm asking what the replacement looks like, in order to better understand how much boilerplate this call is hiding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. In the case where this API is used, users can build Routes
in advance, so they can set some layers to the Routes
with some means, for example tower
's ServiceBuilder
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand -- do you have a code snippet showing what that would look like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following is an example if using tower
's ServiceBuilder
:
let routes = Routes::new(service()).prepare();
let service = tower::ServiceBuilder::new()
.layer(layer())
.service(routes);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At a high level, I wonder if it makes more sense to think about deprecating either Routes
or Server
entirely.
It seems like they both do nearly the same thing, except for Server
allowing for actually running (server) the server.. so it feels weird to incrementally deprecate a method here and there when it's (IMO) a bigger problem that they two types both exist with such heavy overlap.
I don't think so. |
a86793b
to
8f4bf88
Compare
Removes
into_service()
api. This is the same as the one composed of the layers and theRoutes
.