Expand description
Handlers: the Handler trait, handler closures, and the glue that turns
extractor closures into stored handlers.
Most route handlers are plain async closures (|c: Call| async { ... }, or
a closure taking extractors). They reach the Router via
IntoHandler, which adapts a closure into a real Handler and lets it
be boxed into a BoxHandler for storage.
Structs§
- Handler
FnAdapter - Adapter that wraps a marker-disambiguated
HandlerFnclosure into a realHandler.
Traits§
- Handler
- Anything that can handle a
Calland produce aResponse. - Handler
Fn - Bridge trait implemented by handler closures of a given arity. The LAST
closure argument is
FromCall(consuming); all earlier ones areFromCallParts(borrowing). Handlers must beCloneso the closure can be moved into the'staticresponse future. - Into
Handler - Bridge from a closure (or anything that is already a
Handler) into a value implementingHandler, so it can be passed toboxedand the router.
Functions§
- boxed
- Box a
Handlerinto a shareableBoxHandlerfor storage in theRouter.
Type Aliases§
- BoxHandler
- A type-erased, shared handler — the form the
Routerstores. Create one withboxed. - Handler
Future - A boxed,
'staticfuture returned by aHandler.