into_collapsed

Function into_collapsed 

Source
pub fn into_collapsed(path: impl Into<Utf8PathBuf>) -> Utf8PathBuf
Expand description

Collapses a path buffer without performing I/O.

  • Resolves ../ segments where possible.
  • Removes ./ segments, except when leading
  • All redundant separators and up-level references are collapsed.

Example:

  • a/b/../c becomes a/c
  • a/../../c becomes ../c
  • ./some becomes ./some
  • ./some/./path becomes ./some/path
  • /a/../c becomes /c
  • /a/../../c becomes /c

However, this does not resolve symbolic links. It consumes the input Utf8PathBuf and returns a new one.