File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,30 @@ impl PathBuf {
6464 pub fn new ( ) -> PathBuf {
6565 std:: path:: PathBuf :: new ( ) . into ( )
6666 }
67+
68+ /// Truncates `self` to [`self.parent`].
69+ ///
70+ /// Returns `false` and does nothing if [`self.parent`] is [`None`].
71+ /// Otherwise, returns `true`.
72+ ///
73+ /// [`None`]: https://doc.rust-lang.org/std/option/enum.Option.html#variant.None
74+ /// [`self.parent`]: struct.PathBuf.html#method.parent
75+ ///
76+ /// # Examples
77+ ///
78+ /// ```
79+ /// use async_std::path::{Path, PathBuf};
80+ ///
81+ /// let mut p = PathBuf::from("/test/test.rs");
82+ ///
83+ /// p.pop();
84+ /// assert_eq!(Path::new("/test"), p.as_ref());
85+ /// p.pop();
86+ /// assert_eq!(Path::new("/"), p.as_ref());
87+ /// ```
88+ pub fn pop ( & mut self ) -> bool {
89+ self . inner . pop ( )
90+ }
6791}
6892
6993impl From < std:: path:: PathBuf > for PathBuf {
You can’t perform that action at this time.
0 commit comments