Skip to main content

build_rest_op_resolver_with_prefix

Function build_rest_op_resolver_with_prefix 

Source
pub fn build_rest_op_resolver_with_prefix(
    prefix: &str,
    routes: &'static [RouteTransportDescriptor],
) -> impl Fn(&Request<Body>) + Send + Sync
Expand description

build_rest_op_resolver for a router mounted under prefix, e.g. build_rest_op_resolver_with_prefix("/api", ROUTE_TRANSPORTS) to match Router::nest("/api", router).

prefix is forgiving about spelling — "/api", "/api/" and "api" are the same mount — but strict about boundaries: a path that is not under the prefix at a segment boundary resolves unresolved rather than being matched on a truncated remainder. /apiary/... is not under /api.