Skip to main content

Layer

Trait Layer 

Source
pub trait Layer<Inner> {
    type LayerType;

    // Required method
    fn layer(&self, inner: Inner) -> Self::LayerType;
}
Expand description

A trait for creating middleware layers. This trait enables the creation of middleware that can wrap and extend the functionality of other components.

§Type Parameters

  • Inner - The type being wrapped

Required Associated Types§

Source

type LayerType

The type that this layer produces

Required Methods§

Source

fn layer(&self, inner: Inner) -> Self::LayerType

Wraps an inner type with this layer

§Arguments
  • inner - The inner component to wrap
§Returns

A new instance wrapped with this layer’s functionality

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F> Layer<F> for DebuggingForwarderLayer
where F: Forwarder + Send, <F as Subscriber>::Message: Debug, <F as Publisher>::Message: Debug,

Source§

type LayerType = DebugForwarder<F>

Source§

impl<P> Layer<P> for DebuggingPublisherLayer
where P: Publisher + Send, P::Message: Debug,

Source§

type LayerType = DebugPublisher<P>

Source§

impl<P> Layer<P> for LoggingPublisherLayer
where P: Publisher + Send, P::Message: Display,

Source§

type LayerType = LoggingPublisher<P>

Source§

impl<S> Layer<S> for DebuggingSubscriberLayer
where S: Subscriber + Send, S::Message: Debug,

Source§

type LayerType = DebugSubscriber<S>

Source§

impl<S> Layer<S> for LoggingSubscriberLayer
where S: Subscriber + Send, S::Message: Display,

Source§

type LayerType = LoggingSubscriber<S>