Skip to main content

BoxedHandler

Type Alias BoxedHandler 

Source
pub type BoxedHandler = Arc<dyn Fn(Parts, Bytes) -> ResponseFuture + Send + Sync>;
Expand description

A type-erased handler stored in the router.

Handlers receive pre-collected body bytes. This enables both Hyper and Axum body types to be collected at the router boundary before dispatch, avoiding body-type coupling in the handler infrastructure.

Uses Arc (rather than Box) so handlers can be cloned for dual registration (e.g., both REST and native gRPC dispatch).

Aliased Typeยง

pub struct BoxedHandler { /* private fields */ }