pub fn build_rpc_ops_filter(
ops: &'static [OpDescriptor],
) -> impl Fn(&Request<Body>) + Send + SyncExpand description
Build a rate-limit filter function for RPC schemas.
Returns a function that:
- Extracts
op_idfrom/rpc/{op_id}paths - Looks up the op in the provided descriptors
- Returns
false(exempt) ifrate_limited_by_defaultis false - Returns
true(apply rate limit) if the op participates, or if lookup fails
Fails closed: if descriptor lookup misses for any reason, the op is rate-limited. This prevents accidental exemptions from missing data.
/rpc/batch is always rate-limited regardless of its contents — see
the module-level “Known limitation” doc above.
Since ADR 0015 slice 2 (cratestack#877) this is a projection of
build_rpc_op_resolver — one lookup shared with idempotency. Every
case above that resolver answers OpAdmission::unresolved, whose
rate_limited_by_default is true: the same fail-closed answer. For a
router mounted with Router::nest, pass
build_rpc_op_resolver_with_prefix to
super::RateLimitLayer::with_op_resolver instead.