Module builder

Source
Expand description

Defines a builder API for constructing a Router.

Structs§

AssociatedRouteBuilder
Implements the methods required for associating a number of routes with a single path. This is used by DrawRoutes::associated.
DelegateRouteBuilder
A delegated builder, which is created by DrawRoutes::delegate and returned. The DrawRoutes trait has documentation for using this type.
RouterBuilder
The top-level builder which is created by build_router and passed to the provided closure. See the build_router function and the DrawRoutes trait for usage.
ScopeBuilder
A scoped builder, which is created by DrawRoutes::scope and passed to the provided closure. The DrawRoutes trait has documentation for using this type.
SingleRouteBuilder
Implements the traits required to define a single route, after determining which request paths will be dispatched here. The DefineSingleRoute trait has documentation for using this type.

Traits§

DefineSingleRoute
Describes the API for defining a single route, after determining which request paths will be dispatched here. The API here uses chained function calls to build and add the route into the RouterBuilder which created it.
DrawRoutes
Defines functions used by a builder to determine which request paths will be dispatched to a route. This trait is implemented by the top-level RouterBuilder, and also the ScopedBuilder created by DrawRoutes::scope.
ExtendRouteMatcher
Describes the operation of extending a RouteMatcher on a route. This trait exists to remove type clutter from the documentation of SingleRouteBuilder::add_route_matcher.
ReplacePathExtractor
Describes the operation of replacing a PathExtractor on a route. This trait exists to remove type clutter from the documentation of SingleRouteBuilder::with_path_extractor.
ReplaceQueryStringExtractor
Describes the operation of replacing a QueryStringExtractor on a route. This trait exists to remove type clutter from the documentation of SingleRouteBuilder::with_query_string_extractor.

Functions§

build_router
Builds a Router using the provided closure. Routes are defined using the RouterBuilder value passed to the closure, and the Router is constructed before returning.
build_simple_router
Builds a Router with no middleware using the provided closure. Routes are defined using the RouterBuilder value passed to the closure, and the Router is constructed before returning.

Type Aliases§

AssociatedSingleRouteBuilder
The default type returned when building a single associated route. See router::builder::DefineSingleRoute for an overview of the ways that a route can be specified.