oceanpkg_shared/ext/
path.rs

1use std::path::{Path, PathBuf};
2
3/// Extended functionality for
4/// [`PathBuf`](https://doc.rust-lang.org/std/path/struct.PathBuf.html).
5pub trait PathBufExt {
6    /// Like `join`, only reusing the underlying buffer.
7    fn pushing<P: AsRef<Path>>(self, path: P) -> PathBuf;
8}
9
10impl PathBufExt for PathBuf {
11    fn pushing<P: AsRef<Path>>(mut self, path: P) -> PathBuf {
12        self.push(path);
13        self
14    }
15}