Function join_path

Source
pub fn join_path(path: &str, fragment: &str) -> String
Expand description

Join a path with a fragment (omitting empty fragments)

assert_eq!(join_path("index.html", ""), "index.html");
assert_eq!(join_path("index.html", "child"), "index.html#child");

// whitespace is normalized
assert_eq!(join_path("  index.html  ", "  "), "index.html");
assert_eq!(join_path("  index.html  ", "  child  "), "index.html#child");