pub fn build_rest_ops_filter(
routes: &'static [RouteTransportDescriptor],
) -> impl Fn(&Request<Body>) + Send + SyncExpand description
Build a rate-limit filter function for REST schemas.
Returns a function that:
- Reads the matched route pattern via
axum::extract::MatchedPath(populated by axum under bothRouter::layerandRouter::route_layer— see module docs). - Looks up the route (matched pattern + HTTP method) in the provided descriptors.
- Returns
false(exempt) ifrate_limited_by_defaultis false. - Returns
true(apply rate limit) if the route participates, or if lookup fails for any reason.
Fails closed: if MatchedPath is absent (the request matched no
route — a 404) or the route isn’t found in routes (a schema/router
mismatch), the request is rate-limited. This prevents accidental
exemptions from missing data or misconfiguration.
Since ADR 0015 slice 2 (cratestack#877) this is a projection of
build_rest_op_resolver — one lookup shared with idempotency, whose
miss (OpAdmission::unresolved) is rate_limited_by_default: true,
i.e. exactly the fail-closed answer above. For a router mounted with
Router::nest, pass build_rest_op_resolver_with_prefix to
super::RateLimitLayer::with_op_resolver instead.