lxutil

Trait PathExt

Source
pub trait PathExt {
    // Required method
    fn from_lx(path: &(impl AsRef<LxStr> + ?Sized)) -> Result<Cow<'_, Self>>
       where Self: ToOwned;
}
Expand description

Extensions to Path to convert Unix-style paths to a native path, using the same rules as PathBuf.

Required Methods§

Source

fn from_lx(path: &(impl AsRef<LxStr> + ?Sized)) -> Result<Cow<'_, Self>>
where Self: ToOwned,

Creates a Path by converting a Unix-style path to its native representation, avoiding allocation if unnecessary.

§Windows

This function does not allocate (returns a Cow::Borrowed) if the path contains no separators and no characters that need to be escaped. Otherwise, it allocates a PathBuf and returns a Cow::Owned.

§Unix

This function never allocates and always returns a Cow::Borrowed.

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 Path

Source§

fn from_lx(path: &(impl AsRef<LxStr> + ?Sized)) -> Result<Cow<'_, Self>>

Implementors§