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 {
64
64
pub fn new ( ) -> PathBuf {
65
65
std:: path:: PathBuf :: new ( ) . into ( )
66
66
}
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
+ }
67
91
}
68
92
69
93
impl From < std:: path:: PathBuf > for PathBuf {
You can’t perform that action at this time.
0 commit comments