Trait burger::ServiceExt
source · pub trait ServiceExt<Request>: Service<Request> {
Show 13 methods
// Provided methods
async fn oneshot(&self, request: Request) -> Self::Response
where Self: Sized { ... }
fn then<F>(self, closure: F) -> Then<Self, F>
where Self: Sized { ... }
fn map<F>(self, closure: F) -> Map<Self, F>
where Self: Sized { ... }
fn concurrency_limit(self, n_permits: usize) -> ConcurrencyLimit<Self>
where Self: Sized { ... }
fn load_shed(self) -> LoadShed<Self>
where Self: Sized { ... }
fn buffer(self, capacity: usize) -> Buffer<Self>
where Self: Sized { ... }
fn rate_limit(self, interval: Duration, permits: usize) -> RateLimit<Self>
where Self: Sized { ... }
fn retry<P>(self, policy: P) -> Retry<Self, P>
where Self: Sized { ... }
fn depressurize(self) -> Depressurize<Self>
where Self: Sized { ... }
fn pending_requests(self) -> PendingRequests<Self>
where Self: Sized { ... }
fn leak<'t>(self: Arc<Self>) -> Leak<'t, Self>
where Self: Sized { ... }
fn left<T>(self) -> Either<Self, T>
where Self: Sized { ... }
fn right<T>(self) -> Either<T, Self>
where Self: Sized { ... }
}
Expand description
An extension trait for Service
.
Provided Methods§
sourceasync fn oneshot(&self, request: Request) -> Self::Responsewhere
Self: Sized,
async fn oneshot(&self, request: Request) -> Self::Responsewhere
Self: Sized,
Acquires the Service::Permit
and then immediately uses it to call the
Service
.
§Example
use burger::*;
let svc = service_fn(|x: usize| async move { x.to_string() });
let response = svc.oneshot(32).await;
sourcefn then<F>(self, closure: F) -> Then<Self, F>where
Self: Sized,
fn then<F>(self, closure: F) -> Then<Self, F>where
Self: Sized,
Extends the service using a closure accepting Self::Response
and
returning a Future
.
See the module for more information.
sourcefn map<F>(self, closure: F) -> Map<Self, F>where
Self: Sized,
fn map<F>(self, closure: F) -> Map<Self, F>where
Self: Sized,
Extends the service using a closure accepting Self::Response and returning a
Future
.
See the module for more information.
sourcefn concurrency_limit(self, n_permits: usize) -> ConcurrencyLimit<Self>where
Self: Sized,
fn concurrency_limit(self, n_permits: usize) -> ConcurrencyLimit<Self>where
Self: Sized,
Applies a concurrency limit to the service with a specified number of permits.
See concurrency limit module for more information.
sourcefn load_shed(self) -> LoadShed<Self>where
Self: Sized,
fn load_shed(self) -> LoadShed<Self>where
Self: Sized,
Applies load shedding to the service.
See module for more information.
sourcefn buffer(self, capacity: usize) -> Buffer<Self>where
Self: Sized,
fn buffer(self, capacity: usize) -> Buffer<Self>where
Self: Sized,
Applies buffering to the service with a specified capacity.
See the module for more information.
sourcefn rate_limit(self, interval: Duration, permits: usize) -> RateLimit<Self>where
Self: Sized,
fn rate_limit(self, interval: Duration, permits: usize) -> RateLimit<Self>where
Self: Sized,
Applies rate limiting to the service with a specified interval and number of permits.
See the module for more information.
sourcefn depressurize(self) -> Depressurize<Self>where
Self: Sized,
fn depressurize(self) -> Depressurize<Self>where
Self: Sized,
Depressurizes the service.
See the module for more information,
sourcefn pending_requests(self) -> PendingRequests<Self>where
Self: Sized,
fn pending_requests(self) -> PendingRequests<Self>where
Self: Sized,
sourcefn leak<'t>(self: Arc<Self>) -> Leak<'t, Self>where
Self: Sized,
fn leak<'t>(self: Arc<Self>) -> Leak<'t, Self>where
Self: Sized,
Extends the lifetime of the permit.
See the module for more information.
sourcefn left<T>(self) -> Either<Self, T>where
Self: Sized,
fn left<T>(self) -> Either<Self, T>where
Self: Sized,
Wraps as Either::Left. For the other variant see ServiceExt::right.
See the module for more information.
sourcefn right<T>(self) -> Either<T, Self>where
Self: Sized,
fn right<T>(self) -> Either<T, Self>where
Self: Sized,
Wraps as Either::Right. For the other variant see ServiceExt::right.
See the module for more information.