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 409a10a commit 1bd17f1Copy full SHA for 1bd17f1
src/path/pathbuf.rs
@@ -10,6 +10,24 @@ pub struct PathBuf {
10
inner: std::path::PathBuf,
11
}
12
13
+impl PathBuf {
14
+ /// Coerces to a [`Path`] slice.
15
+ ///
16
+ /// [`Path`]: struct.Path.html
17
18
+ /// # Examples
19
20
+ /// ```
21
+ /// use async_std::path::{Path, PathBuf};
22
23
+ /// let p = PathBuf::from("/test");
24
+ /// assert_eq!(Path::new("/test"), p.as_path());
25
26
+ pub fn as_path(&self) -> &Path {
27
+ self.inner.as_path().into()
28
+ }
29
+}
30
+
31
impl From<std::path::PathBuf> for PathBuf {
32
fn from(path: std::path::PathBuf) -> PathBuf {
33
PathBuf { inner: path }
0 commit comments