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
consume_err
count_input
Input counting middleware.
get_extension
Middleware that gets called with either a shared reference or owned Arc to the 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.
ArcLayer
Layer for Arcing a crate::Service.
ConsumeErr
Consumes this service’s error value and returns Infallible.
ConsumeErrLayer
A Layer that produces ConsumeErr services.
CountInput
Service that counts total and concurrent inputs and exposes a tracker via extensions.
CountInputLayer
A Layer that produces CountInput services.
GetInputExtensionOwned
Middleware for retrieving an owned Arc value from input extensions.
GetInputExtensionOwnedLayer
Layer for retrieving an owned Arc value from input extensions.
GetInputExtensionRef
Middleware for retrieving a shared reference from input extensions.
GetInputExtensionRefLayer
Layer for retrieving a shared reference from input extensions.
GetOutputExtensionOwned
Middleware for retrieving an owned Arc value from output extensions.
GetOutputExtensionOwnedLayer
Layer for retrieving an owned Arc value from output extensions.
GetOutputExtensionRef
Middleware for retrieving a shared reference from output extensions.
GetOutputExtensionRefLayer
Layer for retrieving a shared reference from output extensions.
GracefulIoLayer
A Layer that turns I/O input into GracefulIo and injects CancelIo.
GracefulIoService
A Service that wraps I/O input with GracefulIo and injects a CancelIo extension.
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.