PathBufExt

Trait PathBufExt 

Source
pub trait PathBufExt {
    // Required method
    fn with(self, other: impl AsRef<Path>) -> Self;
}
Expand description

Extensions for PathBuf.

See also ACP #209

Required Methods§

Source

fn with(self, other: impl AsRef<Path>) -> Self

Join path to self and return self, so it can be chained.

let path = PathBuf::from("a").with("b").with("c");
// Same thing, but with a lot more allocations
assert_eq!(path, PathBuf::from("a").join("b").join("c"));

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 with(self, path: impl AsRef<Path>) -> Self

Implementors§