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.

Implementations§

👎Deprecated since 0.2.0: use the new gotham::router::builder API to construct a Router

Manually assembles a Router instance from a provided Tree.

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.

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.