Module singleton

Module singleton 

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

Singleton pools

This ensures that only one active connection is made.

The singleton pool wraps a MakeService<T, Req> so that it only produces a single Service<Req>. It bundles all concurrent calls to it, so that only one connection is made. All calls to the singleton will return a clone of the inner service once established.

This fits the HTTP/2 case well.

§Example

let mut pool = Singleton::new(some_make_svc);

let svc1 = pool.call(some_dst).await?;

let svc2 = pool.call(some_dst).await?;
// svc1 == svc2

Structs§

Singleddocsrs
A cached service returned from a Singleton.
Singleton
A singleton pool over an inner service.