Module map

Module map 

Source
Available on crate features client and client-pool only.
Expand description

Map pool utilities

The map isn’t a typical Service, but rather stand-alone type that can map requests to a key and service factory. This is because the service is more of a router, and cannot determine which inner service to check for backpressure since it’s not know until the request is made.

The map implementation allows customization of extracting a key, and how to construct a MakeService for that key.

§Example

let mut map = pool::map::Map::builder()
    .keys(|uri| (uri.scheme().clone(), uri.authority().clone()))
    .values(|_uri| {
        some_http1_connector()
    })
    .build();

let resp = map.service(req.uri()).call(req).await;

Structs§

Builderdocsrs
A builder to configure a Map.
Map
A map caching MakeServices per key.