Application/Server-level management and routing configuration and testing support; outermost functionality.

Handler construction and prototypes

Macros for quality-of-life when interacting with Handlers

A convenience import to gather all of ratpack’s dependencies in one easy place. To use:


compose_handler allows you to combine multiple crate::handler::HandlerFunc functions into a single crate::handler::Handler, so that they cascade through a chain of responsibility. This means that each handler will feed its output into the input of the next. To start, the first http::Response is std::option::Option::None, and the final return Response must be non-None; otherwise a 500 Internal Server Error is returned. Handlers may do anything they wish to the http::Request between processing periods, including replacing the request entirely.


NoState is an empty crate::TransientState.

An error for server-related issues.


General errors for ratpack handlers. Yield either a StatusCode for a literal status, or a String for a 500 Internal Server Error. Other status codes should be yielded through http::Response returns.


TransientState must be implemented to use state between handlers.

Type Definitions

HTTPResult is the return type for handlers. If a handler terminates at the end of its chain with std::option::Option::None as the http::Response, a 500 Internal Server Error will be returned. If you wish to return Err(), a http::StatusCode or std::string::String can be returned, the former is resolved to its status with an empty body, and the latter corresponds to a 500 Internal Server Error with the body set to the string.

Params are a mapping of name -> parameter for the purposes of routing.