Skip to main content

alux_http/
path.rs

1/// Appends one normalized path segment to a composed absolute path.
2///
3/// Selector composition concatenates path parts, so interpreters share one normalization rule:
4/// leading and trailing slashes are removed from `part`, exactly one separator is inserted before a
5/// non-empty segment, and empty or root-only parts leave `path` unchanged.
6pub fn append_path(path: &mut String, part: &str) {
7    let part = part.trim_matches('/');
8    if !part.is_empty() {
9        path.push('/');
10        path.push_str(part);
11    }
12}