Skip to main content Crate topcoat_router Copy item path Source content Request extractors and response types for Topcoat handlers. error Turning handler errors into HTTP responses. header HTTP header types request response tower towerUse tower services and middleware with Topcoat. href Builds a URL for a page or route. Use href!(handler, ...) for links, form actions, and redirects to Topcoat handlers so their URLs follow the registered paths. module_router discoverModule routing is the recommended default for Topcoat applications. The module_router! macro derives a handler’s path from its enclosing Rust module. Use #[page], #[layout], #[layer], and #[route(GET)] without path strings, and organize routes in modules. Body The HTTP body type used for both requests and responses. BodyDataStream A Stream over the data frames of a Body ,
yielding the raw Bytes of each frame. BodyLimit A router layer that overrides the request body size limit for the routes
under its path. BodyPanicError The error a Body ends with when producing one of its frames panicked. CatchAllSegments Decoded segments captured by a catch-all path parameter. Compression compressionConfigures the compression a Router applies to
responses. DirectoryRoute fsA Route that serves files from a directory on disk. Endpoint The set of routes registered at a single URL path, indexed by HTTP method. HeaderMap A specialized multimap for
header names and values. HeaderName Represents an HTTP header field name HeaderValue Represents an HTTP header field value. Href A URL being built by href . HrefSegments The segments an HrefParam fills its path parameter with. Ipv4Net An IPv4 network address. Ipv6Net An IPv6 network address. LayerFn A Layer backed by a plain handler function. LayoutFn A Layout backed by a plain render function. Method The Request Method (VERB) Next The continuation of a Layer chain: the remaining layers followed by the
chain’s terminal handler. OriginLayer A Layer enforcing an OriginPolicy . OriginPolicy The cross-origin request policy the router applies to every request. PageFn A Page backed by a plain render function. PageWithLayouts A Page paired with the Layout s that wrap it. Path A borrowed route pattern made of /-separated segments. PathBuf An owned route path, similar to std::path::PathBuf but for URL paths. PathSegments An iterator over the PathSegment s of a Path , created by
Path::segments . RawPathParams The values a matched route captured, in the order the endpoint’s path
declares them. RawPathParamsIter An iterator over the raw path parameters captured by a route, created by
raw_path_params . RemoteAddr The IP address and port of the direct connection, stored in the request
extensions . RouteFn A Route backed by a plain handler function. RouteId The identity of a registered handler. Router A finalized Topcoat routing table. RouterBuilder Builds a Router for a Topcoat application. RouterService serveA Router together with the configuration it is served with. StatusCode An HTTP status code (status-code in RFC 9110 et al.). StripPrefixLayer Removes a route pattern’s matching prefix from the request URI. TrustedProxies Configures which reverse proxies can report the client’s IP address. Uri The URI component of a request. CompressionLevel compressionThe quality a Compression configuration encodes with, trading
compression ratio against CPU time. ForwardedHeader The HTTP header used to read the client’s IP address from a trusted proxy. IpNet An IP network address, either IPv4 or IPv6. Methods The HTTP methods a Route responds to, as returned by
Route::methods . OwnedMethods An owned counterpart to Methods , stored by routes like
RouteFn . PathError The reason a string could not be parsed into a Path by
Path::from_str . PathSegment A single segment of a route Path . RawPathParamValue A value captured by the matched route. SegmentKind The kind of a module-router path segment, set via the segment! macro. TrailingSlash How the router treats a request for the other trailing-slash form of a
route’s path. HrefParam A value for one path parameter, named after the parameter it fills. HrefParams The path parameters of an href : a tuple of up to eight HrefParam
values, in the order the path declares its parameters. HrefQueries The query of an href : a tuple of up to eight Serialize items,
collected by Href::query . HrefTarget The destination an href points at, resolved to the route Path the
URL is built from. IntoIpNet A value that can be passed to TrustedProxies::networks . IntoPath Conversion into a route path, accepted by APIs that take a path prefix. Layer A request-processing layer that wraps the routes nested under its path,
similar to a tower middleware. Layout A layout handler that wraps pages whose path starts with the layout’s path
prefix. Listener serveA bound listener the serve functions can accept connections from. Page A page handler that renders a View for a specific
URL path. PathParam A typed view of a path parameter declared by the path_param! macro. QueryParams A typed view of the request’s query string, as declared by
#[query_params] . Route A single routable endpoint: a set of HTTP methods, a URL path, and a
handler. RouterBuilderDirectoryExt fsAdds directory-serving methods to RouterBuilder . body_limit Returns the request’s effective body size limit in bytes. endpoint Returns the endpoint the current request matched. href Builds a URL for a page or route. internal_serve serveServes a RouterService on an already-bound Listener until
shutdown completes. parse_query_params Deserializes the query string of the request cx belongs to into T. path_param Reads a typed path parameter from the matched route’s path. query_params Parses the request’s query string into a typed struct. raw_path_params Iterates over the raw path parameters captured by the matched route, as
(name, value) pairs. route Returns the route handling the current request. router Returns the router handling this request. to_bytes Collects an entire Body into Bytes , failing if it exceeds limit. try_endpoint Returns the endpoint the current request matched, or None if its path
matched none (a 404) or no router dispatched it. try_route Returns the route handling the current request, or None if none matched:
the path matched no endpoint (a 404), the endpoint holds no route for the
request’s method (a 405), or no router dispatched the request. try_router Returns the router handling this request, or None if the context does
not belong to a router request. BoxError A boxed error type used by the response body machinery. LayerFuture The future returned by Layer::handle and Next::run : a boxed, Send
future borrowing the chain and the request context. LayerHandlerFn The handler function backing a LayerFn . LayoutRenderFn The render function backing a LayoutFn , receiving the child content as
a Slot . PageRenderFn The render function backing a PageFn . QueryParamsError The error produced when the request’s query string fails to deserialize,
carrying the path of the key that failed. RouteFuture The future returned by Route::handle : a boxed, Send future borrowing
the route and its request context. RouteHandlerFn The async handler function backing a RouteFn . Slot The content a Layout wraps: the page, already composed with any inner
layouts.