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

Holds all of the routes for an application.

A typical use case is that when we want to move to a new route (such as after clicking on an anchor tag) we’ll query our router to see if the new route matches any of our route definitions.

Then if we find a matching route we’ll return it.

Implementations§

Provide the application state data that different routes need.

Create a new Router.

let router = Router::new(create_routes![index_route, products_route]);

Return the matching RouteHandler given some incoming_route

Get the first route in our routes vector view that handles this incoming_route and return the view for that route.

You’ll typically call this when trying to render the correct view based on the page URL or after clicking on an anchor tag.

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 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.