Module burger::concurrency_limit
source · Expand description
The ServiceExt::concurrency_limit
combinator returns
ConcurrencyLimit
which restricts the number of inflight calls to a specified
value.
§Example
use burger::*;
let svc = service_fn(|x| async move {
sleep(Duration::from_secs(1)).await;
2 * x
})
.concurrency_limit(1);
let (a, b) = join! {
svc.oneshot(6),
svc.oneshot(2)
};
§Load
The Load::load
on ConcurrencyLimit defers to the inner service.
Structs§
- A wrapper for the
ServiceExt::concurrency_limit
combinator. - The
Service::Permit
type forConcurrencyLimit
.