Struct gotham::router::Router

source ·
pub struct Router { /* private fields */ }
Expand description

Responsible for dispatching HTTP requests to defined routes, and responding with appropriate error codes when a valid Route is unable to be determined or the dispatch cannot be performed.

A Router is constructed through the gotham::router::builder API, and used with the gotham::start function when booting a Gotham web application.

The Router is capable of delegating requests to secondary Router instances, which allows the support of “modular applications”. A modular application contains multiple applications within a single binary that have clear boundaries established via Rust module separation. Please see the documentation for DrawRoutes::delegate within gotham::router::builder in order to delegate to other Router instances.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Handles the Request by determining the correct Route from the internal Tree, storing any path related variables in State and dispatching to the associated Handler.

The type of Handler created by the NewHandler.
Create and return a new Handler value.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more