path_absolutize

Trait Absolutize

Source
pub trait Absolutize {
    // Required methods
    fn absolutize(&self) -> Result<Cow<'_, Path>>;
    fn absolutize_from(&self, cwd: impl AsRef<Path>) -> Result<Cow<'_, Path>>;
    fn absolutize_virtually(
        &self,
        virtual_root: impl AsRef<Path>,
    ) -> Result<Cow<'_, Path>>;
}
Expand description

Let Path and PathBuf have absolutize and absolutize_virtually method.

Required Methods§

Source

fn absolutize(&self) -> Result<Cow<'_, Path>>

Get an absolute path. This works even if the path does not exist.

Source

fn absolutize_from(&self, cwd: impl AsRef<Path>) -> Result<Cow<'_, Path>>

Get an absolute path. This works even if the path does not exist. It gets the current working directory as the second argument.

Source

fn absolutize_virtually( &self, virtual_root: impl AsRef<Path>, ) -> Result<Cow<'_, Path>>

Get an absolute path. This works even if the path does not exist.

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 Absolutize for Path

Source§

fn absolutize(&self) -> Result<Cow<'_, Path>>

Source§

fn absolutize_from(&self, cwd: impl AsRef<Path>) -> Result<Cow<'_, Path>>

Source§

fn absolutize_virtually( &self, virtual_root: impl AsRef<Path>, ) -> Result<Cow<'_, Path>>

Source§

impl Absolutize for PathBuf

Source§

fn absolutize(&self) -> Result<Cow<'_, Path>>

Source§

fn absolutize_from(&self, cwd: impl AsRef<Path>) -> Result<Cow<'_, Path>>

Source§

fn absolutize_virtually( &self, virtual_root: impl AsRef<Path>, ) -> Result<Cow<'_, Path>>

Implementors§