⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content
Discussion options

You must be logged in to vote

It currently cannot be named, that's correct. What I've done in reqwest, besides also wrapping it as a service, is to convert it into a trait object. Something like this:

let map_svc = service_fn(move |req| {
    let mut mapped = map.service(req.uri()).call(req.uri());
    async move {
        let mut svc = mapped.await?;
        svc.ready().await?;
        svc.call(req).await
    }
});

let pool_as_svc = tower::util::BoxService::new(map_svc);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hatoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
C-feature Category: feature. This is adding a new feature.
2 participants
Converted from issue

This discussion was converted from issue #3993 on December 14, 2025 14:36.