pub trait ServiceExt<Request>: Service<Request> + Sized {
// Provided methods
fn with_timeout(self, timeout: Duration) -> Timeout<Self> { ... }
fn with_rate_limit(self, max: u64, interval: Duration) -> RateLimit<Self> { ... }
fn with_concurrency_limit(self, max: usize) -> ConcurrencyLimit<Self> { ... }
fn map_err<F, E2>(self, f: F) -> MapErr<Self, F>
where F: FnOnce(Self::Error) -> E2 { ... }
fn map_response<F, Response2>(self, f: F) -> MapResponse<Self, F>
where F: FnOnce(Self::Response) -> Response2 { ... }
fn boxed(self) -> BoxService<Request, Self::Response, Self::Error>
where Self: Send + 'static,
Request: Send + 'static,
Self::Future: Send + 'static { ... }
}Expand description
Extension trait for ergonomic service composition.
This provides a fluent API for building middleware stacks
without manual ServiceBuilder boilerplate.
Provided Methods§
Sourcefn with_timeout(self, timeout: Duration) -> Timeout<Self>
fn with_timeout(self, timeout: Duration) -> Timeout<Self>
Apply a timeout to this service.
Sourcefn with_rate_limit(self, max: u64, interval: Duration) -> RateLimit<Self>
fn with_rate_limit(self, max: u64, interval: Duration) -> RateLimit<Self>
Apply rate limiting to this service.
Sourcefn with_concurrency_limit(self, max: usize) -> ConcurrencyLimit<Self>
fn with_concurrency_limit(self, max: usize) -> ConcurrencyLimit<Self>
Apply concurrency limiting to this service.
Sourcefn map_response<F, Response2>(self, f: F) -> MapResponse<Self, F>
fn map_response<F, Response2>(self, f: F) -> MapResponse<Self, F>
Map responses from this service.
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.