pub fn normalize(path: impl AsRef<Path>) -> Result<PathBuf, PathError>Expand description
Lexically normalize a path without accessing the filesystem.
Collapses ., resolves .. where possible, and removes empty segments
produced by repeated separators. Leading .. components on relative paths
are preserved. Absolute paths that would escape the root via .. stop at
the root (Unix / or Windows drive/UNC root).
§Filesystem access
No. This never calls std::fs::canonicalize and does not follow symlinks.
§Drive-relative paths
Windows drive-relative paths (C:foo, C:) are rejected.
§Examples
use path_rs::normalize;
use std::path::PathBuf;
let p = normalize("foo/./bar/../baz").unwrap();
assert_eq!(p, PathBuf::from("foo/baz"));