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 input extensions
- 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 Layerfor adding some shareable value to incoming Context.- Consume
Err - Consumes this service’s error value and returns
Infallible. - Consume
ErrLayer - A
Layerthat producesConsumeErrservices. - GetExtension
- Middleware for retrieving some shareable value from incoming Context.
- GetExtension
Layer Layerfor retrieving some shareable value from incoming Context.- Hijack
Layer - Middleware to hijack request to a
Servicewhich match using aMatcher. - Hijack
Service - Middleware to hijack request to a
Servicewhich match using aMatcher. - Layer
Error Fn - A
MakeLayerErrorimplementation that returns a new error value every time. - Layer
Error Static - A
MakeLayerErrorimplementation that always returns clone of the same error value. - LayerFn
- A
Layerimplemented by a closure. See the docs forlayer_fnfor 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
Layerthat producesMapErrservices. - MapRequest
- Composes a function in front of the service.
- MapRequest
Layer - A
Layerthat producesMapRequestservices. - MapResponse
- Maps this service’s response value to a different value.
- MapResponse
Layer - A
Layerthat produces aMapResponseservice. - 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
Layerthat produces aMapResultservice. - Maybe
Layered Service MaybeLayeredServiceisServicewhich is created by using anOption<Layer>- 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
Layerthat producesTraceErrservices.
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 aFnreturning an error type.