lxutil

Trait PathBufExt

Source
pub trait PathBufExt {
    // Required methods
    fn from_lx(path: impl AsRef<LxStr>) -> Result<PathBuf>;
    fn push_lx(&mut self, path: impl AsRef<LxStr>) -> Result<()>;
}
Expand description

Extensions to PathBuf to convert Unix-style paths to a native path.

§Windows

Paths are converted to native by switching the separators from / to \, and by escaping characters that are not legal in NTFS file names (such as \, :, and others) by mapping them into a private unicode range (0xf000).

This is primarily useful for relative paths which will be passed to the methods of LxVolume. While you can translate absolute paths, the result will have no drive letter.

§Unix

Paths are already native so no conversion is performed.

Required Methods§

Source

fn from_lx(path: impl AsRef<LxStr>) -> Result<PathBuf>

Creates a PathBuf by converting a Unix-style path to its native representation.

Source

fn push_lx(&mut self, path: impl AsRef<LxStr>) -> Result<()>

Extends self with path, first converting it from a Unix-style path to its native representation.

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 PathBufExt for PathBuf

Source§

fn from_lx(path: impl AsRef<LxStr>) -> Result<PathBuf>

Source§

fn push_lx(&mut self, path: impl AsRef<LxStr>) -> Result<()>

Implementors§