Trait Layer
trait Layer<S>
Decorates a Service, transforming either the request or the response.
Often, many of the pieces needed for writing network applications can be
reused across multiple services. The Layer trait can be used to write
reusable components that can be applied to very different kinds of services;
for example, it can be applied to services operating on different protocols,
and to both the client and server side of a network transaction.
Log
Take request logging as an example:
# use Service;
# use ;
# use Layer;
# use fmt;
// This service implements the Log behavior
The above log implementation is decoupled from the underlying protocol and is also decoupled from client or server concerns. In other words, the same log middleware could be used in either a client or a server.
Associated Types
type ServiceThe wrapped service
Required Methods
fn layer(self: &Self, inner: S) -> <Self as >::ServiceWrap the given service with the middleware, returning a new service that has been decorated with the middleware.
Implementors
impl<S, L1, L2, L3> Layer for (L1, L2, L3)impl<S, L1, L2, L3, L4> Layer for (L1, L2, L3, L4)impl<S, L1, L2, L3, L4, L5> Layer for (L1, L2, L3, L4, L5)impl<S, L1, L2, L3, L4, L5, L6> Layer for (L1, L2, L3, L4, L5, L6)impl<S, L1, L2, L3, L4, L5, L6, L7> Layer for (L1, L2, L3, L4, L5, L6, L7)impl<S, L1, L2, L3, L4, L5, L6, L7, L8> Layer for (L1, L2, L3, L4, L5, L6, L7, L8)impl<S, L1, L2, L3, L4, L5, L6, L7, L8, L9> Layer for (L1, L2, L3, L4, L5, L6, L7, L8, L9)impl<S, L1, L2, L3, L4, L5, L6, L7, L8, L9, L10> Layer for (L1, L2, L3, L4, L5, L6, L7, L8, L9, L10)impl<S, L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11> Layer for (L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11)impl<S> Layer for Identityimpl<S, L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, L12> Layer for (L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, L12)impl<S, L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, L12, L13> Layer for (L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, L12, L13)impl<S, L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, L12, L13, L14> Layer for (L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, L12, L13, L14)impl<S, L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, L12, L13, L14, L15> Layer for (L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, L12, L13, L14, L15)impl<S, L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, L12, L13, L14, L15, L16> Layer for (L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, L12, L13, L14, L15, L16)impl<'a, T, S> Layer for &'a Timpl<F, S, Out> Layer for LayerFn<F>impl<S, Inner, Outer> Layer for Stack<Inner, Outer>impl<S> Layer for ()impl<S, L1> Layer for (L1)impl<S, L1, L2> Layer for (L1, L2)