Module layer
Expand description
Layer type and utilities.
Layers are the abstraction of middleware in Rama.
Direct copy of tower-layer.
Modules§
- add_
extension - Middleware that clones a value into the incoming Context.
- get_
extension - Middleware that gets called with a clone of the value of to given type if it is available in the current
Context
. - limit
- A middleware that limits the number of in-flight requests.
- timeout
- Middleware that applies a timeout to requests.
Structs§
- AddExtension
- Middleware for adding some shareable value to incoming Context.
- AddExtension
Layer Layer
for adding some shareable value to incoming Context.- Consume
Err - Consumes this service’s error value and returns
Infallible
. - Consume
ErrLayer - A
Layer
that producesConsumeErr
services. - GetExtension
- Middleware for adding some shareable value to incoming Context.
- GetExtension
Layer Layer
for adding some shareable value to incoming Context.- Hijack
Layer - Middleware to hijack request to a
Service
which match using aMatcher
. - Hijack
Service - Middleware to hijack request to a
Service
which match using aMatcher
. - Layer
Error Fn - A
MakeLayerError
implementation that returns a new error value every time. - Layer
Error Static - A
MakeLayerError
implementation that always returns clone of the same error value. - LayerFn
- A
Layer
implemented by a closure. See the docs forlayer_fn
for more details. - Limit
- Limit requests based on a
Policy
. - Limit
Layer - Limit requests based on a
Policy
. - MapErr
- Maps this service’s error value to a different value.
- MapErr
Layer - A
Layer
that producesMapErr
services. - MapRequest
- Composes a function in front of the service.
- MapRequest
Layer - A
Layer
that producesMapRequest
services. - MapResponse
- Maps this service’s response value to a different value.
- MapResponse
Layer - A
Layer
that produces aMapResponse
service. - MapResult
- Maps this service’s result type (
Result<Self::Response, Self::Error>
) to a different value, regardless of whether the future succeeds or fails. - MapResult
Layer - A
Layer
that produces aMapResult
service. - MapState
- Middleware that can be used to map the state, and pass it as the new state for the inner service.
- MapState
Layer - Middleware that can be used to map the state, and pass it as the new state for the inner service.
- Timeout
- Applies a timeout to requests.
- Timeout
Layer - Applies a timeout to requests via the supplied inner service.
- Trace
Err - Service which traces the error using [
tracing
], of the innerService
. - Trace
ErrLayer - A
Layer
that producesTraceErr
services.
Traits§
- Layer
- A layer that produces a Layered service (middleware(inner service)).
- Make
Layer Error - Utility error trait to allow Rama layers
to return a default error as well as a user-defined one,
being it a
Clone
-able type or aFn
returning an error type.