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 an incoming input’s or an output’s extensions
- get_
extension - Middleware that gets called with a clone of the value of to given type if it is available in the current input/output extensions.
- limit
- A middleware that limits the number of in-flight inputs.
- timeout
- Middleware that applies a timeout to inputs.
Structs§
- AddInput
Extension - Middleware for adding some shareable value to incoming input’s extensions.
- AddInput
Extension Layer Layerfor adding some shareable value to incoming input’s extensions.- AddOutput
Extension - Middleware for adding some shareable value to an output’s extensions.
- AddOutput
Extension Layer Layerfor adding some shareable value to an output’s extensions.- Consume
Err - Consumes this service’s error value and returns
Infallible. - Consume
ErrLayer - A
Layerthat producesConsumeErrservices. - GetInput
Extension - Middleware for retrieving shareable value from input extensions.
- GetInput
Extension Layer Layerfor retrieving some shareable value from input extensions.- GetOutput
Extension - Middleware for retrieving shareable value from output extensions.
- GetOutput
Extension Layer Layerfor retrieving some shareable value from output extensions.- 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. - MapInput
- Composes a function in front of the service.
- MapInput
Layer - A
Layerthat producesMapInputservices. - MapOutput
- Maps this service’s output value to a different value.
- MapOutput
Layer - A
Layerthat produces aMapOutputservice. - 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.