File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 1
1
use std:: ffi:: OsStr ;
2
2
3
- use crate :: path:: { Ancestors , Components , PathBuf } ;
3
+ use crate :: path:: { Ancestors , Components , Display , PathBuf } ;
4
4
use crate :: { fs, io} ;
5
5
6
6
/// This struct is an async version of [`std::path::Path`].
@@ -106,6 +106,24 @@ impl Path {
106
106
self . inner . components ( )
107
107
}
108
108
109
+ /// Returns an object that implements [`Display`] for safely printing paths
110
+ /// that may contain non-Unicode data.
111
+ ///
112
+ /// [`Display`]: https://doc.rust-lang.org/std/fmt/trait.Display.html
113
+ ///
114
+ /// # Examples
115
+ ///
116
+ /// ```
117
+ /// use async_std::path::Path;
118
+ ///
119
+ /// let path = Path::new("/tmp/foo.rs");
120
+ ///
121
+ /// println!("{}", path.display());
122
+ /// ```
123
+ pub fn display ( & self ) -> Display < ' _ > {
124
+ self . inner . display ( )
125
+ }
126
+
109
127
/// Returns `true` if the path points at an existing entity.
110
128
///
111
129
/// This function will traverse symbolic links to query information about the
You can’t perform that action at this time.
0 commit comments