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§
Sourcefn normalize(&self) -> PathBuf
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.
Sourcefn try_normalize(&self) -> Option<PathBuf>
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.
Sourcefn is_normalized(&self) -> bool
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.