feat(server): Remove into_service api#1996
Conversation
| } | ||
|
|
||
| /// 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.
So how would you spell this in 0.13?
There was a problem hiding this comment.
What is the purpose? Should this api be kept in 0.13?
There was a problem hiding this comment.
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.
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.
I understand -- do you have a code snippet showing what that would look like?
There was a problem hiding this comment.
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);
tobz
left a comment
There was a problem hiding this comment.
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.