Skip to main content

path_has_prefix

Function path_has_prefix 

Source
pub fn path_has_prefix(path: &str, prefix: &str) -> bool
Expand description

Whether path is prefix or lies beneath it, on a segment boundary.

A raw starts_with let /public catch /publicity and /public-admin, which are different resources that merely share letters. So /public matches /public and /public/... and nothing else. A prefix written with a trailing slash already ends on a boundary and keeps its literal meaning: /public/ matches /public/x but not /public.