[][src]Trait path_calculate::calculate::Calculate

pub trait Calculate {
    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>>;
fn add_path(&self, path: &Path) -> Result<Cow<'_, Path>>; }

Let Path and PathBuf have some path calculate methods.

Required methods

fn home_dir(&self) -> Result<Cow<'_, Path>>[src]

Get current env's home_dir if it exist.

fn as_absolute_path(&self) -> Result<Cow<'_, Path>>[src]

Get the absolute path, even if the path is not exist.

fn relative_root_with(&self, path_b: &Path) -> Result<Cow<'_, Path>>[src]

Get a relative root path betwwen two pathes.

fn related_to(&self, src_path: &Path) -> Result<Cow<'_, Path>>[src]

Get dst_path's relative path from the src_path.

fn add_path(&self, path: &Path) -> Result<Cow<'_, Path>>[src]

Add a relative path and return a new path.

Loading content...

Implementations on Foreign Types

impl Calculate for Path[src]

impl Calculate for PathBuf[src]

Loading content...

Implementors

Loading content...