We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6c6106a commit a57ba7eCopy full SHA for a57ba7e
src/path/path.rs
@@ -109,6 +109,17 @@ impl Path {
109
fs::metadata(self).await.is_ok()
110
}
111
112
+ /// Converts a [`Box<Path>`][`Box`] into a [`PathBuf`] without copying or
113
+ /// allocating.
114
+ ///
115
+ /// [`Box`]: https://doc.rust-lang.org/std/boxed/struct.Box.html
116
+ /// [`PathBuf`]: struct.PathBuf.html
117
+ pub fn into_path_buf(self: Box<Path>) -> PathBuf {
118
+ let rw = Box::into_raw(self) as *mut std::path::Path;
119
+ let inner = unsafe { Box::from_raw(rw) };
120
+ inner.into_path_buf().into()
121
+ }
122
+
123
/// Queries the file system to get information about a file, directory, etc.
124
///
125
/// This function will traverse symbolic links to query information about the
0 commit comments