Skip to main content

IntoHandler

Trait IntoHandler 

Source
pub trait IntoHandler<Marker> {
    type Handler: Handler;

    // Required method
    fn into_handler(self) -> Self::Handler;
}
Expand description

Bridge from a closure (or anything that is already a Handler) into a value implementing Handler, so it can be passed to boxed and the router.

Two disjoint impls:

  • extractor closures (HandlerFn<Marker>) wrap into a HandlerFnAdapter;
  • anything already implementing Handler (including a BoxHandler) passes through unchanged.

Required Associated Types§

Source

type Handler: Handler

The concrete Handler type this value converts into.

Required Methods§

Source

fn into_handler(self) -> Self::Handler

Convert self into its Handler representation.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<Marker, H> IntoHandler<(IsHandler, Marker)> for H
where Marker: Send + Sync + 'static, H: HandlerFn<Marker>,

Closures of any supported arity convert via the adapter. The wrapping marker keeps this disjoint from the IsHandler pass-through (closures do not implement Handler directly, so no closure can match both impls).