Skip to main content

match_path

Function match_path 

Source
fn match_path(pattern: &str, path: &str) -> bool
Expand description

Matches a path pattern against an actual path. Supports:

  • Exact match: /api/v1/users
  • Prefix with wildcard: /api/v1/*
  • Glob segments: /api/*/users

A trailing /* matches the bare prefix itself (/api/v1) and anything below it (/api/v1/users/123), but not sibling prefixes (/api/v10). A * segment matches exactly one path segment, so segment patterns require the same number of segments as the path.