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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.