Skip to main content

Crate fastapi_router

Crate fastapi_router 

Source
Expand description

Trie-based HTTP router.

This crate provides a high-performance radix trie router optimized for the fastapi_rust framework.

§Features

  • Radix trie for fast lookups
  • Path parameter extraction (/items/{id})
  • Type-safe path converters
  • Static route optimization

§Role In The System

fastapi-router is responsible for matching incoming paths to handlers and extracting typed parameters. fastapi-core uses it for request dispatch, while fastapi-openapi reads its parameter metadata when generating specs. Keeping the router isolated allows the rest of the framework to stay focused on request semantics rather than path matching internals.

Structs§

AllowedMethods
Allowed methods for a matched path.
InvalidRouteError
Error returned when a route path is invalid.
ParamInfo
Path parameter information with optional OpenAPI metadata.
Route
A route definition with handler for request processing.
RouteConflictError
Error returned when a new route conflicts with an existing one.
RouteMatch
A matched route with extracted parameters.
RouteRegistration
A route registration entry placed in a linker section.
RouteResponse
Response declaration for OpenAPI documentation.
RouteSecurityRequirement
Security requirement for a route.
Router
Radix trie router.

Enums§

ConversionError
Error type for parameter conversion failures.
Converter
Path parameter type converter.
ParamValue
A type-converted path parameter value.
RouteAddError
Error returned when adding a route fails.
RouteLookup
Result of attempting to locate a route by path and method.

Functions§

extract_path_params
Extract path parameters from a route path pattern.
registered_routes
Return all routes registered via the link-section table.