Expand description
Ordered path parameter storage (PathParams).
Ordered path parameter storage.
PathParams preserves the order in which path parameters appear in the URL
pattern, which is essential for correct tuple-based extraction such as
Path<(T1, T2)>. Internally it is a Vec<(String, String)>, but it exposes
a small subset of the HashMap-like API (get, iter, len, is_empty,
insert, values) so existing callers can continue to look up parameters
by name without any code changes.
§Why a Vec and not a HashMap?
HashMap iteration order is non-deterministic. URL routers (matchit in
particular) yield parameters in URL declaration order, which is the order
users expect when destructuring Path<(T1, T2)>. Storing parameters in a
Vec<(String, String)> preserves that order all the way from the router to
the extractor.
See issue #4013 for details.
Structs§
- Path
Params - Ordered collection of path parameters extracted from a URL pattern.