Skip to main content

Module layer

Module layer 

Expand description

Layer type and utilities.

Layers are the abstraction of middleware in Rama.

Direct copy of tower-layer.

Modules§

abort
Middleware that allows a user to cancel an operation using a controller.
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§

Abortable
Applies the option to abort an inner service.
AbortableLayer
Applies the option to abort an inner service.
AddInputExtension
Middleware for adding some shareable value to incoming input’s extensions.
AddInputExtensionLayer
Layer for adding some shareable value to incoming input’s extensions.
AddOutputExtension
Middleware for adding some shareable value to an output’s extensions.
AddOutputExtensionLayer
Layer for adding some shareable value to an output’s extensions.
ConsumeErr
Consumes this service’s error value and returns Infallible.
ConsumeErrLayer
A Layer that produces ConsumeErr services.
GetInputExtension
Middleware for retrieving shareable value from input extensions.
GetInputExtensionLayer
Layer for retrieving some shareable value from input extensions.
GetOutputExtension
Middleware for retrieving shareable value from output extensions.
GetOutputExtensionLayer
Layer for retrieving some shareable value from output extensions.
HijackLayer
Middleware to hijack an inputs to a Service which match using a Matcher.
HijackService
Middleware to hijack inputs to a Service which match using a Matcher.
LayerErrorFn
A MakeLayerError implementation that returns a new error value every time.
LayerErrorStatic
A MakeLayerError implementation that always returns clone of the same error value.
LayerFn
A Layer implemented by a closure. See the docs for layer_fn for more details.
Limit
Limit inputs based on a Policy.
LimitLayer
Limit inputs based on a Policy.
MapErr
Maps this service’s error value to a different value.
MapErrLayer
A Layer that produces MapErr services.
MapInput
Composes a function in front of the service.
MapInputLayer
A Layer that produces MapInput services.
MapOutput
Maps this service’s output value to a different value.
MapOutputLayer
A Layer that produces a MapOutput 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.
MapResultLayer
A Layer that produces a MapResult service.
MaybeLayeredService
MaybeLayeredService is Service which is created by using an Option<Layer>
Timeout
Applies a timeout to inputs.
TimeoutLayer
Applies a timeout to inputs via the supplied inner service.
TraceErr
Service which traces the error using [tracing], of the inner Service.
TraceErrLayer
A Layer that produces TraceErr services.

Traits§

Layer
A layer that produces a Layered service (middleware(inner service)).
MakeLayerError
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 a Fn returning an error type.

Functions§

layer_fn
Returns a new LayerFn that implements Layer by calling the given function.