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

feat(server): Remove into_service api #1996

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tottoto
Copy link
Collaborator

@tottoto tottoto commented Oct 12, 2024

Removes into_service() api. This is the same as the one composed of the layers and the Routes.

@@ -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`")]
Copy link
Collaborator

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?

Copy link
Collaborator Author

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?

Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

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?

Copy link
Collaborator Author

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);

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.

2 participants