PathExt

Trait PathExt 

Source
pub trait PathExt {
    // Required methods
    fn relative_to(&self, to: impl AsRef<Utf8Path>) -> Option<Utf8PathBuf>;
    fn rebase(
        &self,
        src_root: &Utf8Path,
        dest_root: &Utf8Path,
    ) -> Result<Utf8PathBuf>;
    fn unbase(&self, base: &Utf8Path) -> Result<Utf8PathBuf>;
}

Required Methods§

Source

fn relative_to(&self, to: impl AsRef<Utf8Path>) -> Option<Utf8PathBuf>

converts this absolute path to relative if the start matches

Source

fn rebase( &self, src_root: &Utf8Path, dest_root: &Utf8Path, ) -> Result<Utf8PathBuf>

removes the src_root from the path and adds the dest_root

Source

fn unbase(&self, base: &Utf8Path) -> Result<Utf8PathBuf>

removes base from path (making sure they match)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl PathExt for Utf8Path

Source§

fn relative_to(&self, to: impl AsRef<Utf8Path>) -> Option<Utf8PathBuf>

Source§

fn rebase( &self, src_root: &Utf8Path, dest_root: &Utf8Path, ) -> Result<Utf8PathBuf>

Source§

fn unbase(&self, base: &Utf8Path) -> Result<Utf8PathBuf>

Source§

impl PathExt for Utf8PathBuf

Source§

fn relative_to(&self, to: impl AsRef<Utf8Path>) -> Option<Utf8PathBuf>

Source§

fn rebase( &self, src_root: &Utf8Path, dest_root: &Utf8Path, ) -> Result<Utf8PathBuf>
where Self: Sized,

Source§

fn unbase(&self, base: &Utf8Path) -> Result<Utf8PathBuf>

Implementors§