Trait PathExt

Source
pub trait PathExt {
    // Required methods
    fn slash_str(&self) -> String;
    fn full_str(&self) -> &str;
    fn ext_str(&self) -> &str;
    fn stem_str(&self) -> &str;
    fn name_str(&self) -> &str;
    fn create_parent_dir_all(&self) -> Result<()>;
    fn merge<P: AsRef<Path>>(&self, append: P) -> PathBuf;
    fn is_file(&self) -> bool;
    fn is_dir(&self) -> bool;
    fn walk_dir<F: Fn(&Path) -> bool>(&self, filter: F) -> Vec<PathBuf>;
    fn walk_iter<F: Fn(&Path) -> bool>(
        &self,
        filter: F,
    ) -> impl Iterator<Item = PathBuf>;
    fn mkdir_after_remove(&self) -> Result<PathBuf>;
}

Required Methods§

Source

fn slash_str(&self) -> String

output full path with slash

e.g. “test\test.txt” -> “test/test.txt”

Source

fn full_str(&self) -> &str

output full path with backslash

e.g. “test/test.txt” -> “test\test.txt”

Source

fn ext_str(&self) -> &str

Source

fn stem_str(&self) -> &str

Source

fn name_str(&self) -> &str

Source

fn create_parent_dir_all(&self) -> Result<()>

Source

fn merge<P: AsRef<Path>>(&self, append: P) -> PathBuf

Source

fn is_file(&self) -> bool

Source

fn is_dir(&self) -> bool

Source

fn walk_dir<F: Fn(&Path) -> bool>(&self, filter: F) -> Vec<PathBuf>

Source

fn walk_iter<F: Fn(&Path) -> bool>( &self, filter: F, ) -> impl Iterator<Item = PathBuf>

Source

fn mkdir_after_remove(&self) -> Result<PathBuf>

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.

Implementors§

Source§

impl<T: AsRef<Path>> PathExt for T