pub trait Calculate {
// Required methods
fn home_dir(&self) -> Result<Cow<'_, Path>>;
fn as_absolute_path(&self) -> Result<Cow<'_, Path>>;
fn relative_root_with(&self, path_b: &Path) -> Result<Cow<'_, Path>>;
fn related_to(&self, src_path: &Path) -> Result<Cow<'_, Path>>;
}Expand description
Let Path and PathBuf have some path calculate methods.
Required Methods§
Sourcefn as_absolute_path(&self) -> Result<Cow<'_, Path>>
fn as_absolute_path(&self) -> Result<Cow<'_, Path>>
Get the absolute path, even if the path is not exist.
Sourcefn relative_root_with(&self, path_b: &Path) -> Result<Cow<'_, Path>>
fn relative_root_with(&self, path_b: &Path) -> Result<Cow<'_, Path>>
Get a relative root path betwwen two pathes.
Get dst_path’s relative path from the src_path.