pub trait NormalizePath {
    // Required methods
    fn normalize(&self) -> PathBuf;
    fn try_normalize(&self) -> Option<PathBuf>;
    fn is_normalized(&self) -> bool;
}
Expand description

Extension trait to add normalize_path to std’s Path.

Required Methods§

source

fn normalize(&self) -> PathBuf

Normalize a path without performing I/O.

All redundant separator and up-level references are collapsed.

However, this does not resolve links.

source

fn try_normalize(&self) -> Option<PathBuf>

Same as NormalizePath::normalize except that if Component::Prefix/Component::RootDir is encountered, or if the path points outside of current dir, returns None.

source

fn is_normalized(&self) -> bool

Return true if the path is normalized.

Quirk

If the path does not start with ./ but contains ./ in the middle, then this function might returns true.

Implementations on Foreign Types§

source§

impl NormalizePath for Path

Implementors§