pub fn match_path(
path: &str,
keys: &[String],
entry: &str,
) -> Option<(String, String)>Expand description
The page path names and the part of the path that page answers for, or
None when no page answers for it.
Algorithm - the framework does not pattern-match segments:
- Strip a leading
/. An empty path namesentry(the home page). - Try the full path as a page key; if absent, walk up one segment at a
time to the longest existing prefix (
/user/7->userwhen onlyuser.lmnexists). - The leftover tail after the matched prefix becomes the
segment(/7), for the page’s own code to parse.
Use this where an address that names nothing has an answer of its own,
such as a server sending a 404. Somewhere that has to show a page either
way, such as a window following a link, wants resolve_path.